Laboratory 1 Solutions
Solution to registerStudent.cc code:
/******************************************************************* * Name: Brenda Student * Date: 1/21/14 * Course: CSCI 132 * Assignment: Lab1 * Instructor: Royden * Program: registerStudent.cc * Purpose: This program creates 2 student objects, sets their * graduation dates and adds courses to their course lists. The program * then prints out the student info and course list for each student object. ********************************************************************/ #include "student.h" #include <iostream> using namespace std; int main(void) { int newYear; //Graduation date of new student string9 newCourse; //New course to be added to course list Student newStudent; //New student object Student greatStudent("Mary Contrary", 2010); //Another student cout << "Enter graduation year: "; cin >> newYear; newStudent.SetGradDate(newYear); cout << "Enter name of course to be added: "; cin >> newCourse; newStudent.AddCourse(newCourse); newStudent.ListInfo(); newStudent.ListCourses(); greatStudent.AddCourse("csci262"); greatStudent.AddCourse("csci155"); greatStudent.AddCourse("csci384"); greatStudent.AddCourse("csci381"); greatStudent.ListInfo(); greatStudent.ListCourses(); return 0; } //end main
Home | | Syllabus | | Assignments | | Lecture Notes