954,228 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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

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.

// 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
RichardNero
Newbie Poster
3 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

You're right. Why bother using code tags.

>> int main();
>> {

Should be

>> int main()
>> {

No ; after main.

twomers
Posting Virtuoso
1,877 posts since May 2007
Reputation Points: 453
Solved Threads: 57
 

still get error,
Now that I have no hair......
is there anything else...

RichardNero
Newbie Poster
3 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

> grade(void);
It's just grade();

Next time, use the [code][/code] tags. Between joining the forum and posting your first message there are many opportunities to learn how to do this, and you failed all of them.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You