daily pastebin goal
78%
SHARE
TWEET

Untitled

a guest Oct 19th, 2018 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //GradesDemo - Main Program
  2. /******************************/
  3. //Author: Alex Mendes
  4. //Course: SENG1120
  5. //Program Description: This program demonstrates the basic functionality of queues and stacks.
  6.  
  7. #include <iostream>
  8. #include <cstdlib>
  9. #include "Queue.h"
  10. #include "Stack.h"
  11. using namespace std;
  12.  
  13. int main()
  14. {
  15.     Queue<int> marks;
  16.     int vectorMarks[] = {12, 18, 26, 34, 40, 43, 50, 60, 62, 65, 67, 69, 69, 70, 71, 72, 74, 75, 80, 80, 81, 84, 90, 91, 98};
  17.  
  18.     // FOR SENG6120 students (and extra bonus)
  19.     // int vectorMarks[] = {69, 84, 40, 65, 72, 34, 80, 43, 74, 98, 60, 62, 81, 67, 12, 69, 70, 50, 71, 75, 18, 80, 26, 90, 91};
  20.  
  21.     cout << sizeof(vectorMarks)/sizeof(vectorMarks[0]) << endl << endl;
  22.  
  23.     for (int i=0; i<sizeof(vectorMarks)/sizeof(vectorMarks[0]); i++) {marks.enqueue(vectorMarks[i]);}
  24.    
  25.     // counts the marks in each grade band.
  26.     Stack<int> numberFF;
  27.     Stack<int> numberP;
  28.     Stack<int> numberC;
  29.     Stack<int> numberD;
  30.     Stack<int> numberHD;
  31.  
  32.     // FOR SENG6120 students (or extra bonus)
  33.     // marks.sort();
  34.  
  35.     // prints the average, minimum and maximum score for the class.
  36.     //cout << "Average: " << marks.average() << endl;
  37.     //cout << "Min: " << marks.minimum() << endl;
  38.     //cout << "Max: " << marks.maximum() << endl;
  39.     //cout << "Stdev: " << marks.stdeviation() << endl << endl;
  40.  
  41.     // populates the stacks.
  42.     for (int i=0; i<sizeof(vectorMarks)/sizeof(vectorMarks[0]); i++)
  43.     {
  44.         if (marks.front() < 50) {numberFF.push(marks.front());} // case FF
  45.         else if ((marks.front() >= 50) && (marks.front() < 65)) {numberP.push(marks.front());} // case P
  46.         else if ((marks.front() >= 65) && (marks.front() < 75)) {numberC.push(marks.front());} // case C
  47.         else if ((marks.front() >= 75) && (marks.front() < 85)) {numberD.push(marks.front());} // case D
  48.         else {numberHD.push(marks.front());} // case HD
  49.  
  50.         marks.dequeue();
  51.        
  52.     }
  53.  
  54.     // prints the marks in each grade band.
  55.     //cout << "Number of FF: " << numberFF.size() << "  " << numberFF << endl;
  56.     //cout << "Number of P: " << numberP.size() << "  " << numberP << endl;
  57.     //cout << "Number of C: " << numberC.size() << "  " << numberC << endl;
  58.     //cout << "Number of D: " << numberD.size() << "  " << numberD << endl;
  59.     //cout << "Number of HD: " << numberHD.size() << "  " << numberHD << endl;
  60.  
  61.     cout << "The program has finished." << endl;
  62.     return 0;
  63. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top