SHARE
TWEET

Untitled

a guest Mar 24th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<iomanip>
  3. #include<conio.h>
  4. #include<stdio.h>
  5. #include<limits>
  6.  
  7. using namespace std;
  8.  
  9. //Table Pieces
  10. const unsigned char V= (char)186;
  11. const unsigned char H= (char)205;
  12. const unsigned char BL = (char)185;
  13. const unsigned char BR = (char)204;
  14. const unsigned char M = (char)206;
  15. const unsigned char DM = (char)203;
  16. const unsigned char UM = (char)202;
  17. const unsigned char C1 = (char)201;
  18. const unsigned char C2 = (char)187;
  19. const unsigned char C3= (char)188;
  20. const unsigned char C4 = (char)200;
  21.  
  22. int main()
  23. {
  24.     //Declare variables for use in the program; A's are Assignments
  25.     //and P's are Projects
  26.     double Aone;
  27.     double Atwo;
  28.     double Athree;
  29.     double Afour;
  30.     double Afive;
  31.     double Asix;
  32.     double Aseven;
  33.     double Aeight;
  34.     double Anine;
  35.     double Aten;
  36.     double Pone;
  37.     double Ptwo;
  38.     double result1;  
  39.  
  40.     //Table Variables
  41.     const char sep = ' ';
  42.     const int letWidth = 12;
  43.     const int pointNeed = 15;
  44.     const int percNeed = 19;
  45.  
  46.     //Table Result Variables
  47.     double Apoint;
  48.     double Bpoint;
  49.     double Cpoint;
  50.     double Dpoint;
  51.     double Aperc;
  52.     double Bperc;
  53.     double Cperc;
  54.     double Dperc;
  55.  
  56.     //Scores
  57.     int int1 = 200;
  58.     int int2 = 900;
  59.     int int3 = 800;
  60.     int int4 = 700;
  61.     int int5 = 600;
  62.  
  63.  
  64.  
  65.     //Title
  66.     printf("GRADE PROJECTOR \n");
  67.     printf("------------------------------------------------------- \n");
  68.  
  69.  
  70.     //Prompts for user input
  71.  
  72.     //Assignment 1 Prompt
  73.     cout << "Please enter the score for 'Assignment#1': ";
  74.     cin >> Aone;
  75.     while (1)
  76.     {
  77.         if (cin.fail())
  78.         {
  79.             cin.clear();
  80.             cin.ignore(numeric_limits<streamsize>::max(), '\n');
  81.             cout << "Please try again and enter the correct 'Assignment#1' score" << endl;
  82.             cin >> Aone;
  83.         }
  84.         if (!cin.fail())
  85.             break;
  86.     }
  87.  
  88.     //Assignment 2 Prompt
  89.     cout << "Please enter the score for 'Assignment#2': ";
  90.     cin >> Atwo;
  91.     while (1)
  92.     {
  93.         if (cin.fail())
  94.         {
  95.             cin.clear();
  96.             cin.ignore(numeric_limits<streamsize>::max(), '\n');
  97.             cout << "Please try again and enter the correct 'Assignment#2' score" << endl;
  98.             cin >> Atwo;
  99.         }
  100.         if (!cin.fail())
  101.             break;
  102.     }
  103.  
  104.  
  105.     //Assignment 3 Prompt
  106.     cout << "Please enter the score for 'Assignment#3': ";
  107.     cin >> Athree;
  108.     while (1)
  109.     {
  110.         if (cin.fail())
  111.         {
  112.             cin.clear();
  113.             cin.ignore(numeric_limits<streamsize>::max(), '\n');
  114.             cout << "Please try again and enter the correct 'Assignment#3' score" << endl;
  115.             cin >> Athree;
  116.         }
  117.         if (!cin.fail())
  118.             break;
  119.     }
  120.  
  121.  
  122.     //Assignment 4 Prompt
  123.     cout << "Please enter the score for 'Assignment#4': ";
  124.     cin >> Afour;
  125.     while (1)
  126.     {
  127.         if (cin.fail())
  128.         {
  129.             cin.clear();
  130.             cin.ignore(numeric_limits<streamsize>::max(), '\n');
  131.             cout << "Please try again and enter the correct 'Assignment#4' score" << endl;
  132.             cin >> Afour;
  133.         }
  134.         if (!cin.fail())
  135.             break;
  136.     }
  137.  
  138.  
  139.     //Assignment 5 Prompt
  140.     cout << "Please enter the score for 'Assignment#5': ";
  141.     cin >> Afive;
  142.     while (1)
  143.     {
  144.         if (cin.fail())
  145.         {
  146.             cin.clear();
  147.             cin.ignore(numeric_limits<streamsize>::max(), '\n');
  148.             cout << "Please try again and enter the correct 'Assignment#5' score" << endl;
  149.             cin >> Afive;
  150.         }
  151.         if (!cin.fail())
  152.             break;
  153.     }
  154.  
  155.  
  156.     //Assignment 6 Prompt
  157.     cout << "Please enter the score for 'Assignment#6': ";
  158.     cin >> Asix;
  159.     while (1)
  160.     {
  161.         if (cin.fail())
  162.         {
  163.             cin.clear();
  164.             cin.ignore(numeric_limits<streamsize>::max(), '\n');
  165.             cout << "Please try again and enter the correct 'Assignment#6' score" << endl;
  166.             cin >> Asix;
  167.         }
  168.         if (!cin.fail())
  169.             break;
  170.     }
  171.  
  172.     //Assignment 7 Prompt
  173.     cout << "Please enter the score for 'Assignment#7': ";
  174.     cin >> Aseven;
  175.     while (1)
  176.     {
  177.         if (cin.fail())
  178.         {
  179.             cin.clear();
  180.             cin.ignore(numeric_limits<streamsize>::max(), '\n');
  181.             cout << "Please try again and enter the correct 'Assignment#7' score" << endl;
  182.             cin >> Aseven;
  183.         }
  184.         if (!cin.fail())
  185.             break;
  186.     }
  187.  
  188.     //Assignment 8 Prompt
  189.     cout << "Please enter the score for 'Assignment#8': ";
  190.     cin >> Aeight;
  191.     while (1)
  192.     {
  193.         if (cin.fail())
  194.         {
  195.             cin.clear();
  196.             cin.ignore(numeric_limits<streamsize>::max(), '\n');
  197.             cout << "Please try again and enter the correct 'Assignment#8' score" << endl;
  198.             cin >> Aeight;
  199.         }
  200.         if (!cin.fail())
  201.             break;
  202.     }
  203.  
  204.     //Assignment 9 Prompt
  205.     cout << "Please enter the score for 'Assignment#9': ";
  206.     cin >> Anine;
  207.     while (1)
  208.     {
  209.         if (cin.fail())
  210.         {
  211.             cin.clear();
  212.             cin.ignore(numeric_limits<streamsize>::max(), '\n');
  213.             cout << "Please try again and enter the correct 'Assignment#9' score" << endl;
  214.             cin >> Anine;
  215.         }
  216.         if (!cin.fail())
  217.             break;
  218.     }
  219.  
  220.     //Assignment 10 Prompt
  221.     cout << "Please enter the score for 'Assignment#10': ";
  222.     cin >> Aten;
  223.     while (1)
  224.     {
  225.         if (cin.fail())
  226.         {
  227.             cin.clear();
  228.             cin.ignore(numeric_limits<streamsize>::max(), '\n');
  229.             cout << "Please try again and enter the correct 'Assignment#10' score" << endl;
  230.             cin >> Aten;
  231.         }
  232.         if (!cin.fail())
  233.             break;
  234.     }
  235.  
  236.     //Project 1 Prompt
  237.     cout << "Please enter the score for 'Project#1': ";
  238.     cin >> Pone;
  239.     while (1)
  240.     {
  241.         if (cin.fail())
  242.         {
  243.             cin.clear();
  244.             cin.ignore(numeric_limits<streamsize>::max(), '\n');
  245.             cout << "Please try again and enter the correct 'Project#1' score" << endl;
  246.             cin >> Pone;
  247.         }
  248.         if (!cin.fail())
  249.             break;
  250.     }
  251.  
  252.     //Project 2 Prompt
  253.     cout << "Please enter the score for 'Project#2': ";
  254.     cin >> Ptwo;
  255.     while (1)
  256.     {
  257.         if (cin.fail())
  258.         {
  259.             cin.clear();
  260.             cin.ignore(numeric_limits<streamsize>::max(), '\n');
  261.             cout << "Please try again and enter the correct 'Project#2' score" << endl;
  262.             cin >> Ptwo;
  263.         }
  264.         if (!cin.fail())
  265.             break;
  266.     }
  267.  
  268.  
  269.     //The total of all the assignments and projects
  270.     result1 = Aone + Atwo + Athree + Afour + Afive + Asix + Aseven + Aeight + Anine + Aten + Pone + Ptwo;
  271.  
  272.  
  273.     //Display results of total so far
  274.     printf("\n");
  275.     printf("------------------------------------------------------- \n");
  276.     printf("TOTAL POINTS SO FAR: "),
  277.     printf("%.2lf", result1);
  278.  
  279.  
  280.     //The points needed for whichever grade
  281.     Apoint = (int2 - result1);
  282.     Bpoint = (int3 - result1);
  283.     Cpoint = (int4 - result1);
  284.     Dpoint = (int5 - result1);
  285.  
  286.  
  287.     //The percentage needed for whichever grade
  288.     Aperc = (Apoint / int1);
  289.     Bperc = (Bpoint / int1);
  290.     Cperc = (Cpoint / int1);
  291.     Dperc = (Dpoint / int1);
  292.  
  293.  
  294.     //Display results in table
  295.     cout << endl << endl;
  296.     cout << C1 << H << H << H << H << H << H << H << H << H << H << H << H << DM << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << DM << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << C2 << endl;
  297.     cout << V << setw(letWidth) << setfill(sep) << "FINAL GRADE" << V << setw(pointNeed) << setfill(sep) << "POINTS NEEDED" << V << setw(percNeed) << setfill(sep) << "PERCENTAGE NEEDED" << " " << V << endl;
  298.     cout << BR << H << H << H << H << H << H << H << H << H << H << H << H << M << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << M << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << BL << endl;
  299.     cout << V << setw(letWidth) << setfill(sep) << "A" << V << setw(pointNeed) << setfill(sep) << Apoint << V << setw(percNeed) << setfill(sep) << Aperc << "%" << V << endl;
  300.     cout << V << setw(letWidth) << setfill(sep) << "B" << V << setw(pointNeed) << setfill(sep) << Bpoint << V << setw(percNeed) << setfill(sep) << Bperc << "%" << V << endl;
  301.     cout << V << setw(letWidth) << setfill(sep) << "C" << V << setw(pointNeed) << setfill(sep) << Cpoint << V << setw(percNeed) << setfill(sep) << Cperc << "%" << V << endl;
  302.     cout << V << setw(letWidth) << setfill(sep) << "D" << V << setw(pointNeed) << setfill(sep) << Dpoint << V << setw(percNeed) << setfill(sep) << Dperc << "%" << V << endl;
  303.     cout << C4 << H << H << H << H << H << H << H << H << H << H << H << H << UM << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << UM << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << H << C3 << endl;
  304.    
  305.     //Project 3 Requirement to not fail
  306.     cout << endl << endl;
  307.     cout << "Any 'Project#3' grade that scores below " << Dperc << "% will resuilt in failing the semester" << endl;
  308.  
  309.     _getch();
  310.     return 0;
  311. }
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