Enviado em 24/02/2019 - 11:18h
cabeçalho fornecidovoid lister(double a, double b, int n)
#include <iostream>
#include <cmath>
#include <iomanip>
void listar(double a, double b, int n)
using namespace std;
int main (int argc, char *argv[]){
cout << "Programa para exibir os n primeiros multiplos de a não superiores a b\n";
double a, b;
cout << "a = "; cin >> a;
cout << "b = "; cin >> b;
double n = a;
listar(n);
return 0;
}
void listar(double a, double b, int n){
while (n <= b)
{
cout << n << endl;
n = n + a;
}
return n;
}
[humbra@x550l livro]$ g++ Exercicio12004.cpp -o exp12004
Exercicio12004.cpp:7:1: error: expected initializer before ‘using’
using namespace std;
^~~~~
Exercicio12004.cpp: In function ‘int main(int, char**)’:
Exercicio12004.cpp:10:3: error: ‘cout’ was not declared in this scope
cout << "Programa para exibir os n primeiros multiplos de a não superiores a b\n";
^~~~
Exercicio12004.cpp:10:3: note: suggested alternative:
In file included from Exercicio12004.cpp:1:
/usr/include/c++/8/iostream:61:18: note: ‘std::cout’
extern ostream cout; /// Linked to standard output
^~~~
Exercicio12004.cpp:13:19: error: ‘cin’ was not declared in this scope
cout << "a = "; cin >> a;
^~~
Exercicio12004.cpp:13:19: note: suggested alternative:
In file included from Exercicio12004.cpp:1:
/usr/include/c++/8/iostream:60:18: note: ‘std::cin’
extern istream cin; /// Linked to standard input
^~~
Exercicio12004.cpp:16:3: error: ‘listar’ was not declared in this scope
listar(n);
^~~~~~
Exercicio12004.cpp: In function ‘void listar(double, double, int)’:
Exercicio12004.cpp:26:4: error: ‘cout’ was not declared in this scope
cout << n << endl;
^~~~
Exercicio12004.cpp:26:4: note: suggested alternative:
In file included from Exercicio12004.cpp:1:
/usr/include/c++/8/iostream:61:18: note: ‘std::cout’
extern ostream cout; /// Linked to standard output
^~~~
Exercicio12004.cpp:26:17: error: ‘endl’ was not declared in this scope
cout << n << endl;
^~~~
Exercicio12004.cpp:26:17: note: suggested alternative:
In file included from /usr/include/c++/8/iostream:39,
from Exercicio12004.cpp:1:
/usr/include/c++/8/ostream:590:5: note: ‘std::endl’
endl(basic_ostream<_CharT, _Traits>& __os)
^~~~
Exercicio12004.cpp:29:10: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
return n;
^
tux-gpt - Assistente de IA para o Terminal
Instalação e configuração do Chrony
Programa IRPF - Guia de Instalação e Resolução de alguns Problemas
Como instalar no Linux Jogos da Steam só para Windows
Instalando o Team Viewer no Debian Trixie - problema no Policykit
O Que Fazer Após Instalar Ubuntu 25.04
Copiar Layout do Teclado para aplicar em outra Distribuição (5)
Alguém poderia me ajudar a escolher peças pra montar um desktop? [RESO... (34)