| | |
error C2447: '{' : missing function header (old-style formal list?)
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2007
Posts: 3
Reputation:
Solved Threads: 0
i keep getting this error (error C2447: '{' : missing function header (old-style formal list?)
can someone give me a hint or help me out, I went from 23 errors to 1.
can someone give me a hint or help me out, I went from 23 errors to 1.
c++ Syntax (Toggle Plain Text)
// Enter a grade which is 1 and 100 for user. #include <iostream> using std::cin; using std::cout; using std::endl; using std::cerr; #include <cstdlib> using std::rand; #include <ctime> void grade(); bool isCorrect( int, int ); // function int main(); { // srand( time( 0 ) ); // seed random number generator grade(void); return 0; // termination } // end main // grade generates numbers between 1 and 100 // and checks grade void grade() { int answer; // randomly generated number int guess; // grade entered char response; // 'y' or 'n' do{ // generate random number between 1 and 100 // 1 is shift, 100 is scaling factor answer = 1 + rand() % 100; // prompt for grade cout << "Enter number between 1 and 100.\n" << "Enter Grade?\n" << endl << "? "; cin >> guess; // loop until correct number while ( !isCorrect( guess, answer ) ) cin >> guess; // prompt for another grade cout << "\nExcellent! The grade is !\n" << "Would you like to enter a grade again (y or n)? "; cin >> response; cout << endl; } while ( response == 'y' ); }// end function grade // isCorrect returns true if g equals a // if g does not equal a, displays hint bool isCorrect( int g, int a ) { // grade is correct if ( g == a ) return true; // grade is incorrect; display hint if ( g < a ) cout << "Grade is to low. Try again.\n? "; else cout << "Grade is to high. Try again.\n? "; return false; } // end function isCorrect
Last edited by Ancient Dragon; Nov 16th, 2007 at 6:24 pm. Reason: add code tags
You're right. Why bother using code tags.
>> int main();
>> {
Should be
>> int main()
>> {
No ; after main.
>> int main();
>> {
Should be
>> int main()
>> {
No ; after main.
![]() |
Similar Threads
- error C2447: missing function header(old-style formal list?) (C++)
- error C2447: missing function header (old-style formal list?), what does this mean?! (C++)
Other Threads in the C++ Forum
- Previous Thread: Basic C++ Timer
- Next Thread: Urgent help in this code plz
| Thread Tools | Search this Thread |
api array beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game getline google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text text-file tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






