/********************************************************************* C201 Computer Programming II Fall 2006 Dana Vrajitoru & Definition of the class Student_rec. **********************************************************************/ #include "student_rec.h" #include using namespace std; #include // Constructors // Default constructor. Student_rec::Student_rec() { strcpy(name, ""); id = 0; gpa = 0.0; } // Constructor with explicit name and id. Student_rec::Student_rec(char *the_name, int the_id) { strcpy(name, the_name); id = the_id; gpa = 0.0; } // Copy constructor Student_rec::Student_rec(Student_rec &data) { strcpy(name, data.name); id = data.id; gpa = data.gpa; } // Destructor Student_rec::~Student_rec() { ; } // Inputs the name and the id from the user. void Student_rec::Input_rec() { cout << "Enter the student name" << endl; cin >> name; cout << "Enter the student id" << endl; cin >> id; gpa = 0; } // Outputs the content of the object. void Student_rec::Output_rec() { cout << "Name: " << name << " Id: " << id << " Gpa: " << gpa << endl; } // Computes the gpa from a set of courses. void Student_rec::Compute_gpa(float *grades, int number_courses) { float sum = 0; for(int i=0; i 0) gpa = sum / number_courses; else gpa = 0; }