#include<iostream>
int main()
{
int number; int digit ;
} // <- the main() ends here
{ // <- Is this the offending '{' ?
std::cout << "enter a 4 digit int number:" ;
}
The compiler does tell the line, where it sees a syntax error. That is useful information, both for you and us.
[Edit]
A compiler says (about my code):
In function 'int main()':
5:9: warning: unused variable 'number' [-Wunused-variable]
5:21: warning: unused variable 'digit' [-Wunused-variable]
At global scope:
8:1: error: expected unqualified-id before '{' token
"At global scope": lines 8-10 are not inside any function. What did we forget or misplace?
1 2 3 4 5 6 7 8 9 10 11
#include<iostream>
int main()
{
int number;
int digit ;
{
std::cout << "enter a 4 digit int number:" ;
}
} // <- the main() ends here