error C2447: '{' : missing function header (old-style formal list?) please help.

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2008
Posts: 19
Reputation: Mark515 is an unknown quantity at this point 
Solved Threads: 0
Mark515 Mark515 is offline Offline
Newbie Poster

error C2447: '{' : missing function header (old-style formal list?) please help.

 
0
  #1
Apr 17th, 2008
  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. static const int password=1705898;
  7.  
  8. int main;
  9. {
  10. int secondnumber;
  11. while(true)
  12.  
  13. cout>>("Enter Password")
  14. cin<<(secondnumber)
  15.  
  16. if(password = Enter Password)
  17.  
  18. cout<<"Welcome Lukus";
  19. else
  20. cout<<"Password Rejected";
  21.  
  22. system ("PAUSE")
  23. return 0;
  24. }


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
Last edited by Ancient Dragon; Apr 17th, 2008 at 12:37 pm. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,500
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1479
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: error C2447: '{' : missing function header (old-style formal list?) please help.

 
0
  #2
Apr 17th, 2008
line 8: don't you see something a little strange about that line? hint: () and ;
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 19
Reputation: Mark515 is an unknown quantity at this point 
Solved Threads: 0
Mark515 Mark515 is offline Offline
Newbie Poster

Re: error C2447: '{' : missing function header (old-style formal list?) please help.

 
0
  #3
Apr 17th, 2008
i have also tried that line 8: int main () it did work and i have 1 failed with 75 errors
Last edited by Mark515; Apr 17th, 2008 at 12:45 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,500
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1479
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: error C2447: '{' : missing function header (old-style formal list?) please help.

 
0
  #4
Apr 17th, 2008
>>int main ();
Of course not -- get rid of the semicolon!
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 19
Reputation: Mark515 is an unknown quantity at this point 
Solved Threads: 0
Mark515 Mark515 is offline Offline
Newbie Poster

Re: error C2447: '{' : missing function header (old-style formal list?) please help.

 
0
  #5
Apr 17th, 2008
yes i did im now getting 1 failed with 75 errors.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,500
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1479
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: error C2447: '{' : missing function header (old-style formal list?) please help.

 
0
  #6
Apr 17th, 2008
You need to add { and } when there are more than 1 lines within while statements
  1. while( <condition> )
  2. {
  3. // some lines here
  4. }
  5. else
  6. {
  7. // more lines here
  8. }
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 19
Reputation: Mark515 is an unknown quantity at this point 
Solved Threads: 0
Mark515 Mark515 is offline Offline
Newbie Poster

Re: error C2447: '{' : missing function header (old-style formal list?) please help.

 
0
  #7
Apr 17th, 2008
  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. static const int password=1705898;
  7.  
  8. int main()
  9. {
  10. int secondnumber;
  11. while(true);
  12. }
  13. cout>> ("Enter Password")
  14. cin<< (secondnumber);
  15. {
  16. if(password = Enter Password)
  17.  
  18. cout<<"Welcome Lukus";
  19. }
  20. else
  21. cout<<"Password Rejected";
  22. {
  23. system ("PAUSE")
  24. return 0;
  25. }

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?)
Last edited by Ancient Dragon; Apr 17th, 2008 at 1:39 pm. Reason: please learn to use code tags
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,500
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1479
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: error C2447: '{' : missing function header (old-style formal list?) please help.

 
0
  #8
Apr 17th, 2008
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
Last edited by Ancient Dragon; Apr 17th, 2008 at 1:42 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,500
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1479
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: error C2447: '{' : missing function header (old-style formal list?) please help.

 
0
  #9
Apr 17th, 2008
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)
  1. int main()
  2. {
  3. int secondnumber;
  4. while(true)
  5. {
  6. cout << "Enter Password";
  7. cin >> secondnumber;
  8. if(password == Enter Password)
  9. {
  10. cout<<"Welcome Lukus";
  11. }
  12. else
  13. {
  14. cout<<"Password Rejected";
  15. }
  16. }
  17. system ("PAUSE")
  18. return 0;
  19. }
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,500
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1479
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: error C2447: '{' : missing function header (old-style formal list?) please help.

 
0
  #10
Apr 17th, 2008
>>if(password == Enter Password)

Should be testing for secondnumber
if(password == secondnumber)
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC