当前位置: 首页>>代码示例>>C++>>正文


C++ Course::getUGradApps方法代码示例

本文整理汇总了C++中Course::getUGradApps方法的典型用法代码示例。如果您正苦于以下问题:C++ Course::getUGradApps方法的具体用法?C++ Course::getUGradApps怎么用?C++ Course::getUGradApps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Course的用法示例。


在下文中一共展示了Course::getUGradApps方法的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;
//.........这里部分代码省略.........
开发者ID:CanadianBac0nz,项目名称:2404a5,代码行数:101,代码来源:test.cpp

示例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;
}
开发者ID:CanadianBac0nz,项目名称:2404a5,代码行数:67,代码来源:test.cpp


注:本文中的Course::getUGradApps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。