#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

static const int password=1705898;

int main;
{
		int secondnumber;
		while(true)

				cout>>("Enter Password")
				cin<<(secondnumber)

				if(password = Enter Password)

				cout<<"Welcome Lukus";
			else
				cout<<"Password Rejected";

system ("PAUSE")
return 0;
}

i am getting the error C2447: '{' : missing function header (old-style formal list?) error.
Can anyone tell me where i am going wrong to eliminate this error. thanks

line 8: don't you see something a little strange about that line? hint: () and ;

i have also tried that line 8: int main () it did work and i have 1 failed with 75 errors :S

>>int main ();
Of course not -- get rid of the semicolon!

yes i did im now getting 1 failed with 75 errors. :(

You need to add { and } when there are more than 1 lines within while statements

while( <condition> )
{
   // some lines here
}
else
{
    // more lines here
}
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

static const int password=1705898;

int main()
{
		int secondnumber;
		while(true);
				}
				cout>> ("Enter Password")
				cin<< (secondnumber);
				{
				if(password = Enter Password)

				cout<<"Welcome Lukus";
}
			else
				cout<<"Password Rejected";
				{
system ("PAUSE")
return 0;
}

errors:

line (10) : warning C4101: 'secondnumber' : unreferenced local variable
"(13) : error C2143: syntax error : missing ';' before '>>'
(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(15) : error C2447: '{' : missing function header (old-style formal list?)
(20) : error C2059: syntax error : 'else'
(22) : error C2447: '{' : missing function header (old-style formal list?)

braces are still wrong -- they are backwards and the closing } is on the wrong place. Re-read my previous post again. You need to count the number of opening and closing braces and make sure there is a } for every { (and vice versa)

line 11: delete the semicolon at the end of that while statement

This is how to format the code. I also change a couple of other errors -- you had << and >> reversed. cout uses << and cin uses >>, you have them backwards.

>>if(password == Enter Password)
That is also wrong but I don't know how you need to correct it.


Help with Code Tags (Toggle Plain Text)

int main()
{
    int secondnumber;
    while(true)
    {
           cout << "Enter Password";
          cin >> secondnumber;
          if(password == Enter Password)
          {
               cout<<"Welcome Lukus";
          }
          else
          {
               cout<<"Password Rejected";
         }
}
system ("PAUSE")
return 0;
}

>>if(password == Enter Password)

Should be testing for secondnumber if(password == secondnumber)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.