本文整理汇总了C++中Course::getGradApps方法的典型用法代码示例。如果您正苦于以下问题:C++ Course::getGradApps方法的具体用法?C++ Course::getGradApps怎么用?C++ Course::getGradApps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::getGradApps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testing_minus_ptr
//////////////////////////////////////////////////////////////////////////
// Tests the - with course pointer passed in
void testing_minus_ptr(string courses[]) {
CourseQueue<Course> queue1;
cout << endl << "----- Testing the - for a course pointer -----";
cout << endl << "----- CASE: empty list -----" << endl;
cout << "Original queue: " << queue1;
cout << "Removing course: " << courses[1] << endl;
Course* newCourse = new Course(courses[1]);
CourseQueue<Course> newQueue;
newQueue = queue1 - newCourse;
cout << "New queue: " << newQueue;
delete newCourse->getUGradApps();
delete newCourse->getGradApps();
delete newCourse;
cout << endl << "----- CASE: middle of the list -----" << endl;
for (int i=0; i<5; i++) {
Course* newCourse = new Course(courses[i]);
queue1 += newCourse;
}
cout << "Original queue: " << queue1;
cout << "Removing course: " << courses[2];
newCourse = new Course(courses[2]);
newQueue = queue1 - newCourse;
cout << endl << "New queue: " << newQueue;
delete newCourse->getUGradApps();
delete newCourse->getGradApps();
delete newCourse;
newQueue.clearCopy();
cout << endl << "----- CASE: front of the list -----" << endl;
cout << "Original queue: " << queue1;
cout << "Removing course: " << courses[0];
newCourse = new Course(courses[0]);
newQueue = queue1 - newCourse;
cout << endl << "New queue: " << newQueue;
delete newCourse->getUGradApps();
delete newCourse->getGradApps();
delete newCourse;
newQueue.clearCopy();
cout << endl << "----- CASE: end of the list -----" << endl;
cout << "Original queue: " << queue1;
cout << "Removing course: " << courses[4];
newCourse = new Course(courses[4]);
newQueue = queue1 - newCourse;
cout << endl << "New queue: " << newQueue;
delete newCourse->getUGradApps();
delete newCourse->getGradApps();
delete newCourse;
newQueue.clearCopy();
cout << endl << "----- CASE: element not in list -----" << endl;
cout << "Original queue: " << queue1;
cout << "Removing course: " << courses[8];
newCourse = new Course(courses[8]);
newQueue = queue1 - newCourse;
cout << endl << "New queue: " << newQueue;
delete newCourse->getUGradApps();
delete newCourse->getGradApps();
delete newCourse;
newQueue.clearCopy();
cout << endl << "----- CASE: last element of the list -----" << endl;
!queue1;
newCourse = new Course(courses[0]);
queue1 += newCourse;
cout << "Original queue: " << queue1;
cout << "Removing course: " << courses[0];
newCourse = new Course(courses[0]);
newQueue = queue1 - newCourse;
cout << endl << "New queue: " << newQueue;
//.........这里部分代码省略.........
示例2: testing_minus_equals_ptr
//////////////////////////////////////////////////////////////////////////
// Tests the -= with course pointer passed in
void testing_minus_equals_ptr(string courses[]) {
CourseQueue<Course> queue1;
cout << endl << "----- Testing the -= for a course pointer -----" << endl;
cout << "----- EMPTY LIST CASE -----" << endl;
Course* newCourse = new Course(courses[0]);
queue1 -= newCourse;
delete newCourse->getUGradApps();
delete newCourse->getGradApps();
delete newCourse;
cout << endl << "----- MIDDLE OF LIST CASE -----" << endl;
for (int i=0; i<4; i++) {
Course* newCourse = new Course(courses[i]);
queue1 += newCourse;
}
cout << "Queue: " << queue1;
cout << "Removing " << courses[2] << endl;
newCourse = new Course(courses[2]);
queue1 -= newCourse;
delete newCourse->getUGradApps();
delete newCourse->getGradApps();
delete newCourse;
cout << "Queue after: " << queue1;
cout << endl << "----- FRONT OF LIST CASE -----" << endl;
cout << "Removing " << courses[0] << endl;
newCourse = new Course(courses[0]);
queue1 -= newCourse;
delete newCourse->getUGradApps();
delete newCourse->getGradApps();
delete newCourse;
cout << "Queue after: " << queue1;
cout << endl << "----- END OF LIST CASE -----" << endl;
cout << "Removing " << courses[3] << endl;
newCourse = new Course(courses[3]);
queue1 -= newCourse;
delete newCourse->getUGradApps();
delete newCourse->getGradApps();
delete newCourse;
cout << "Queue after: " << queue1;
cout << endl << "----- LAST ELEMENT OF LIST CASE -----" << endl;
cout << "Removing " << courses[1] << endl;
newCourse = new Course(courses[1]);
queue1 -= newCourse;
delete newCourse->getUGradApps();
delete newCourse->getGradApps();
delete newCourse;
cout << "Queue after: " << queue1 << endl;
}