I made this program to determine the biggest value among 5 numbers using thus format. However I have error during compile. Does it because my compiler is corrupted?
main.cpp: In function ‘int main()’:
main.cpp:17:2: error: ‘cout’ was not declared in this scope
cout << "Value a: ";
^
main.cpp:17:2: note: suggested alternative:
In file included from main.cpp:12:0:
/usr/include/c++/5/iostream:61:18: note: ‘std::cout’
extern ostream cout; /// Linked to standard output
^
main.cpp:18:6: error: ‘cin’ was not declared in this scope
cin >> a;
^
main.cpp:18:6: note: suggested alternative:
In file included from main.cpp:12:0:
/usr/include/c++/5/iostream:60:18: note: ‘std::cin’
extern istream cin; /// Linked to standard input
^
main.cpp:32:48: error: ‘big’ was not declared in this scope
cout << "Biggest value: " << big(a, b, c, d, e);
^
main.cpp: At global scope:
main.cpp:37:1: error: expected unqualified-id before ‘{’ token
{
^
All the names in the standard library are declared in the std namespace so unless you use 'using namespace std;' or similar you need to write std:: in front of cout, cin, etc.
repost your code. It is telling you that you either have something outside a {}
eg
int main()
int x; //no can do
{
or some other syntax error that we can't see in your old code.
double big (double a,double b,double c,double d,double e);
{
this for example is an issue.... your header (has a ;) and your body (does not) are being confused.
int foo(); //header
int foo() //body or implementation
{
return 5;
}
1. You still have the problem by calling your function it is big not biggest
2. also this line does not need ;
"double biggest (double a,double b,double c,double d,double e);"
3. also the for loop are alyaws like for(;;)
4. for loop does not need ;
5. endl in for loop should be std::endl.
Ok I am going to give you the showed-effort award and fixed it for you. I commented the changes. But you MUST learn to read the compiler errors and fix these things yourself, and you MUST learn when to use ; and when not to, or you will have trouble forever. The changes are 1-5 above in action.