#ifndef GRADE_H #define GRADE_H #include //for classes istream and ostream #include //for class string using namespace std; class grade { private: int i; //in the range 0 to n-1 inclusive; 0 means F, 13 means A+ static const size_t n {14}; //the number of possible grades static const string a[n]; //names of the grades: "F", "F+", ..., "A+" public: grade(): i {0} {} //Default constructor puts F into newborn object. grade(const string& s); grade& operator+=(int inc); operator int() const {return i;} friend ostream& operator<<(ostream& ost, const grade& g) { return ost << grade::a[g.i]; } friend istream& operator>>(istream& ist, grade& g); }; #endif