wendelrios
(usa Ubuntu)
Enviado em 27/08/2016 - 23:09h
Olá , estou com um problema para compilar um programa bem simples em c++ , instalei o Ubuntu tem umas 2 semanas , e até agora não consegui compilar nd . Segue o programa abaixo , eu estou usando o Atom :
/* Algoritmo usando o bubble sort.
-------*/
#include<iostream>
void bubble(int vet[5])
{
int i, j, aux;
for(i=0;i<5;i++)
for(j=i+1;j<5;j++){
if(vet[i]>vet[j]){
aux=vet[i];
vet[i]=vet[j];
vet[j]=aux;
}
}
}
cout<<"Vetor Ordenado: ";
for(i=0;i<5;i++){
cout<<vet[i]<<"||";
}
}
int main() {
int num[5] , i;
for(i=0;i<5;i++){
cout<<"Digite o "<<i+1<<"o numero: ";
cin>>num[i];
}
bubble(num);
cout<<"\n\n";
system("pause");
}
o terminal está apresentando o seguinte erro dps q compila :
bubble.cpp: In function ‘void bubble(int*)’:
bubble.cpp:18:75: error: ‘cout’ was not declared in this scope
cout<<"Veto
^
bubble.cpp:18:75: note: suggested alternative:
In file included from bubble.cpp:3:0:
/usr/include/c++/5/iostream:61:18: note: ‘std::cout’
extern ostream cout; /// Linked to standard output
^
bubble.cpp: In function ‘int main()’:
bubble.cpp:28:5: error: ‘cout’ was not declared in this scope
cout<<"Digite o "<<i+1<<"o numero: ";
^
bubble.cpp:28:5: note: suggested alternative:
In file included from bubble.cpp:3:0:
/usr/include/c++/5/iostream:61:18: note: ‘std::cout’
extern ostream cout; /// Linked to standard output
^
bubble.cpp:29:5: error: ‘cin’ was not declared in this scope
cin>>num[i];
^
bubble.cpp:29:5: note: suggested alternative:
In file included from bubble.cpp:3:0:
/usr/include/c++/5/iostream:60:18: note: ‘std::cin’
extern istream cin; /// Linked to standard input
^
bubble.cpp:35:5: error: ‘cout’ was not declared in this scope
cout<<"\n\n";
^
bubble.cpp:35:5: note: suggested alternative:
In file included from bubble.cpp:3:0:
/usr/include/c++/5/iostream:61:18: note: ‘std::cout’
extern ostream cout; /// Linked to standard output
^
bubble.cpp:36:19: error: ‘system’ was not declared in this scope
system("pause");
esperando uma resposta de vcs . Obg.