View Single Post
  #2 (permalink)  
Old 07-22-2007, 05:28 PM
Bench Bench is offline
Full Programmer
Join Date: Jul 2007
Location: UK
Posts: 113
iTrader: (0)
Bench is on a distinguished roadBench is on a distinguished roadBench is on a distinguished roadBench is on a distinguished roadBench is on a distinguished road
Firstly, there should be no semicolons in #include directives
Code:
#include <iostream>;

#include <string>;
Secondly, i'm not sure why you've limited your 'name' to 25 characters, since a string is able to hold as many as you need. (Although perhaps you have your reasons)

Lastly, you're missing a semicolon at the end of your class declaration

Code:
class GradeBook {
public:
    GradeBook(string); // constructor
    void setCourseName(string);
    string getCourseName();
    void displayMessage();
    void inputGrades();
    void displayGradeReport();
    int maximum(int, int, int);
private:
    string courseName;
    int maximumGrade;
} ;

The reason it gave you an error message about your constructor, is that you had written
Code:
#include "GradeBook.h"
on the line before your constructor's definition. The result of which, after the Preprocessor had glued your various #includes together, the compiler ended up thinking you intended your class, GradeBook (which was missing a semicolon), to be the return type of the constructor. Of course, constructors aren't allowed a return type, so the compiler threw up an error.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!

Last edited by Bench : 07-22-2007 at 05:36 PM.
Reply With Quote
The Following User Says Thank You to Bench For This Useful Post:
HelloWorld (07-22-2007)