Need help with a problem

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>

using namespace std;

int main();
{

int Password;

 cout<<"Please write the password: ";
 cin>> Password;
 cin.ignore();
 if ( Password == 123 )
    cout<<"You are now logged in\n";
 else {
    cout<<"Wrong password\n";
 while ( Password !=123) {
     cout<<"Please write the password: ";
 cin>> Password;
 cin.ignore();
 if ( Password == 123 )
    cout<<"You are now logged in\n";
 else {
    cout<<"Wrong password\n";
      }
                        }
      }
}


When I try to compile it i get the error message: error: expected unqualified-id before '{' token
I am using code blocks and the error is the { under int main();


change it to:
int main(){
remove the semicolon on line 5
Ty Peter87 :) it worked
Topic archived. No new replies allowed.