Tuesday, July 28, 2009

C++ Error? Need Help >.<?

#include %26lt;iostream%26gt;


using namespace std;





void main();


{


int number = 1;





system,("pause");


cin %26gt;%26gt; number;


cout %26lt;%26lt; number;


}





error C2447: missing function header (old-style formal list?





No Idea what that means

C++ Error? Need Help %26gt;.%26lt;?
1) remove the semicolon at the end of "void main();" line 4





2) do not use comma in "system,("pause");" line 8





3) change from void main() to int main() and then add "return 0;" at the end





#include %26lt;iostream%26gt;


using namespace std;





int main()


{


int number = 1;





system("pause");


cin %26gt;%26gt; number;


cout %26lt;%26lt; number;





return 0;


}





it also depends on which compiler you use, I used MinGW compiler
Reply:void main(); ---- ??


why do you close it with the smi-colons ?? Basically it means that the statements in the braces below are not called by the OS.





int main() -- this is the missing function header.


{


int number = 1;


system("pause");


cin %26gt;%26gt; number;


cout %26lt;%26lt; number;


}
Reply:#include %26lt;iostream.h%26gt;





there you go. but ive never seen 'using namespace std;' before - check that out.


No comments:

Post a Comment