// File:Student.cpp // Student Class Definition #include "Student.h" #include #include #include // Need for strcpy #include // Need for setw in cout using namespace std; // Need this to uppercase a string string strUpper(string s) { string result=""; for (int i=0;i(Student S1,Student S2) {return(S1.Name>S2.Name);} bool operator==(Student S1,Student S2) {return(S1.Name==S2.Name);} bool operator<(Student S1,string Name) {return(strUpper(S1.Name)(Student S1,string Name) {return(strUpper(S1.Name)>strUpper(Name));} bool operator==(Student S1,string Name) {return(strUpper(S1.Name)==strUpper(Name));} bool operator<<=(Student S1,Student S2) {return(S1.ComputeGPA()>=(Student S1,Student S2) {return(S1.ComputeGPA()>S2.ComputeGPA());} // Print Student Info //void Student::PrintStudentInfo() std::ostream &operator<<(std::ostream &Dest,Student S) {Dest.setf(ios::showpoint); Dest.precision(2); Dest << setiosflags(ios::left) << setw(20) << S.Name << resetiosflags(ios::left); Dest << setw(4) << S.Hours << setw(10) << S.ComputeGPA() << endl; return(Dest); } std::istream &operator>>(std::istream &source,Student &S) {cout << "Enter name >"; getline(source,S.Name); cout << "Enter transfer hours, 0 if none >"; source >> S.Hours; if (S.Hours>0) { cout << "Enter Points Transferred >"; source >> S.Points; } source.ignore(80,'\n'); return(source); } ifstream &operator>>(ifstream &source,Student &S) {getline(source,S.Name); source >> S.Hours >> S.Points; source.ignore(80,'\n'); return(source); } // Get Student's GPA float Student::ComputeGPA() const {if (Hours>0) return(float(Points)/Hours); return(0); }