int main(int nNumberofArgs, char* pszArgs[])
{
int guess;
cout<<"type a number greater than 5: "<<
cin << guess;
}
if(guess>5);
{
cout<<"Congrats! You have succeded!!!"<<;
}
else;
{
cout<<"You have failed this simple task."<<;
}
return 0;
I cant seem to figure out what is wrong. I am very new at programming and i am just a little confused. Any help would be nice. The errors are: expected unqualified-id before if, expected unqualified-id before {, expected unqualified-id before else, expected unqualified-id before {, expected unqualified-id before return.
;O Why close main and have the rest of the code outside the scope?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
int main(int nNumberofArgs, char* pszArgs[])
{
int guess;
cout<<"type a number greater than 5: "<<
cin << guess;
if(guess>5);
{
cout<<"Congrats! You have succeded!!!"<<;
}
else;
{
cout<<"You have failed this simple task."<<;
}
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cstdio>
usingnamespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
int guess;
cout<<"type a number greater than 5: "<<
cin << guess;
} // <---- your main finishes here
if(guess>5);
{
cout<<"Congrats! You have succeded!!!"<<;
}
else;
{
cout<<"You have failed this simple task."<<;
}
return 0;
Edit:
This is your code with other errors fixed...
#include <iostream>
usingnamespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
int guess;
cout << "type a number greater than 5: ";
cin >> guess;
if(guess>5)
{
cout<<"Congrats! You have succeded!!!";
}
else
{
cout<<"You have failed this simple task.";
}
return 0;
}