Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<iomanip>
- #include<conio.h>
- #include<stdio.h>
- #include<limits>
- #include<vector>
- using namespace std;
- using std::vector;
- //Table Pieces
- const unsigned char V = (char)186;
- const unsigned char H = (char)205;
- const unsigned char BL = (char)185;
- const unsigned char BR = (char)204;
- const unsigned char M = (char)206;
- const unsigned char DM = (char)203;
- const unsigned char UM = (char)202;
- const unsigned char C1 = (char)201;
- const unsigned char C2 = (char)187;
- const unsigned char C3 = (char)188;
- const unsigned char C4 = (char)200;
- int main()
- {
- //Declare variables for use in the program; A's are Assignments
- //and P's are Projects
- double result1 = 0;
- vector<float> assignments;
- vector<float> projects;
- //Table Variables
- const char sep = ' ';
- const int letWidth = 12;
- const int pointNeed = 15;
- const int percNeed = 19;
- //Table Result Variables
- double Apoint;
- double Bpoint;
- double Cpoint;
- double Dpoint;
- double Aperc;
- double Bperc;
- double Cperc;
- double Dperc;
- //Scores
- int int1 = 2;
- int int2 = 900;
- int int3 = 800;
- int int4 = 700;
- int int5 = 600;
- //Title
- printf("GRADE PROJECTOR \n");
- printf("------------------------------------------------------- \n");
- //Prompts for user input
- for (int i = 1; i <= 10; i++)
- {
- int enteredValue = 0;
- cout << "Please try again and enter the correct 'Assignment#" << i << "' score" << endl;
- cin >> enteredValue;
- while (1) {
- if (cin.fail())
- {
- cin.clear();
- cin.ignore(numeric_limits<streamsize>::max(), '\n');
- cout << "Please try again and enter the correct 'Assignment#" << i << "' score" << endl;
- cin >> enteredValue;
- }
- else {
- assignments.push_back(enteredValue);
- break;
- }
- }
- }
- for (int i = 1; i <= 2; i++)
- {
- int enteredValue = 0;
- cout << "Please try again and enter the correct 'Project#" << i << "' score" << endl;
- cin >> enteredValue;
- while (1) {
- if (cin.fail())
- {
- cin.clear();
- cin.ignore(numeric_limits<streamsize>::max(), '\n');
- cout << "Please try again and enter the correct 'Assignment#" << i << "' score" << endl;
- cin >> enteredValue;
- }
- else {
- projects.push_back(enteredValue);
- break;
- }
- }
- }
- //The total of all the assignments and projects
- for (unsigned int a = 0; a < 10; a++) {
- result1 += assignments[a];
- }
- for (unsigned int p = 0; p < 2; p++) {
- result1 += projects[p];
- }
- //Display results of total so far
- printf("\n");
- printf("------------------------------------------------------- \n");
- printf("TOTAL POINTS SO FAR: "),
- printf("%.2lf", result1);
- //The points needed for whichever grade
- Apoint = (int2 - result1);
- Bpoint = (int3 - result1);
- Cpoint = (int4 - result1);
- Dpoint = (int5 - result1);
- //The percentage needed for whichever grade
- Aperc = (Apoint / int1);
- Bperc = (Bpoint / int1);
- Cperc = (Cpoint / int1);
- Dperc = (Dpoint / int1);
- //Display results in table
- cout << endl << endl;
- 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;
- cout << V << setw(letWidth) << setfill(sep) << "FINAL GRADE" << V << setw(pointNeed) << setfill(sep) << "POINTS NEEDED" << V << setw(percNeed) << setfill(sep) << "PERCENTAGE NEEDED" << " " << V << endl;
- 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;
- cout << V << setw(letWidth) << setfill(sep) << "A" << V << setw(pointNeed) << setfill(sep) << Apoint << V << setw(percNeed) << setfill(sep) << Aperc << "%" << V << endl;
- cout << V << setw(letWidth) << setfill(sep) << "B" << V << setw(pointNeed) << setfill(sep) << Bpoint << V << setw(percNeed) << setfill(sep) << Bperc << "%" << V << endl;
- cout << V << setw(letWidth) << setfill(sep) << "C" << V << setw(pointNeed) << setfill(sep) << Cpoint << V << setw(percNeed) << setfill(sep) << Cperc << "%" << V << endl;
- cout << V << setw(letWidth) << setfill(sep) << "D" << V << setw(pointNeed) << setfill(sep) << Dpoint << V << setw(percNeed) << setfill(sep) << Dperc << "%" << V << endl;
- 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;
- //Project 3 Requirement to not fail
- cout << endl << endl;
- cout << "Any 'Project#3' grade that scores below " << Dperc << "% will resuilt in failing the semester" << endl;
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement