コード例 #1
0
int main()
{
	string fname, lname;
	float gpa;
	int credits;

	Student MyStudent;

	cout << "Enter First and Last Name, GPA, and Credits Taken" << endl;
	cin >> fname >> lname >> gpa >> credits;

	MyStudent.FirstName(fname);
	MyStudent.LastName(lname);
	MyStudent.GPA(gpa);
	MyStudent.Credits(credits);

	cout << setprecision(1) << fixed;
	cout << setw(30) << left << "Student First Name:" << setw(30) << left << MyStudent.FirstName() << endl;
	cout << setw(30) << left << "Student Last Name:" << setw(30) << left << MyStudent.LastName() << endl;
	cout << setw(30) << left << "Student GPA:" << setw(30) << left << MyStudent.GPA() << endl;
	cout << setw(30) << left << "Student Credits Taken:" << setw(30) << left << MyStudent.Credits() << endl;
	cout << setw(30) << left << "Student Standing:" << setw(30) << left << MyStudent.Standing() << endl;

	system("pause");

	return 0;
}
コード例 #2
0
// Student::Student ///////////////////////////////////////
Student::Student(const Student &s) : Person(s)
{
	if (Student::Debug())
	{
		Student::DebugHeader();
		cout << "Inside of Student::Student() COPY constructor." << endl;
	}
	GPA(s.GPA());
	if (Student::Debug())
	{
		cout << "GPA has been set to " << GPA() << '\n';
		cout << "Leaving Student::Student() COPY constructor." << endl;
		Student::DebugFooter();
	}
}