Skip to content

Instantly share code, notes, and snippets.

@Newtochr

Newtochr/P3-ULT Secret

Created April 18, 2020 16:23
Show Gist options
  • Save Newtochr/4035e30bbe9c352384f323fe70cf6746 to your computer and use it in GitHub Desktop.
Save Newtochr/4035e30bbe9c352384f323fe70cf6746 to your computer and use it in GitHub Desktop.
Final
// #include "stdafx.h"
#include <iostream> // I/O operations
#include <iomanip> // Formatting functions
#include <cstdlib> // General use library functions
#include <string> // Defines dynamic string stuff
using namespace std;
// Prototypes
void splash_scrn(void);
void menu_scrn(string last, string first, string csid, string grade1,
string grade2, string grade3, string grade4, string grade5,
string grade6, char letter_grade);
void output_scrn(string last, string first, string csid, string grade1,
string grade2, string grade3, string grade4, string grade5,
string grade6, char letter_grade);
void transition(void);
void error_scrn(void);
// End of Prototypes
int main() {
// Variable and object creation
string csid = "XXXX";
string first = "XXXX";
string last = "XXXX";
string grade1 = "XXXX";
string grade2 = "XXXX";
string grade3 = "XXXX";
string grade4 = "XXXX";
string grade5 = "XXXX";
string grade6 = "XXXX";
char letter_grade = 'A';
// Transition screen variables
string resp = "XXXX";
string ans = "XXXX";
// Calculation variables
double grade1_num = atof(grade1.c_str());
double grade2_num = atof(grade2.c_str());
double grade3_num = atof(grade3.c_str());
double grade4_num = atof(grade4.c_str());
double grade5_num = atof(grade5.c_str());
double grade6_num = atof(grade6.c_str());
int ctr = 0; // Controls loops
// End of variable declarations
// Start of the Splash Screen
splash_scrn();
// End of the Splash Screen
// Transition to next screen
transition();
// End of transition
// Start of Menu Screen
menu_scrn(last, first, csid, grade1, grade2, grade3, grade4, grade5, grade6, letter_grade);
//menu_scrn() will call input_scrn(), output_scrn(), and error_scrn()
// End of Menu screen
}// End of int main()
// Function Definitions
void splash_scrn(void)
{
system("cls"); // Clear screen through MS OS
cout << R"(
_______ _______ _______ ______ _______ _______
| | | | |______ | ____ | |______
| | | |_____ ______| |_____| | ______|
_
-=\`\
|\ ____\_\__
-=\c`""""""" "`)
`~~~~~/ /~~`---
-==/ /
'-'
_ _
( ` )_
( ) `) _ _
(_ (_ . _) _) ( ` )_
( ) ( _) _)
( ` ) . )
(_, _( ,_)_)
Miramar College
STUDENT GRADE TRACKING SYSTEM
Programmed By: Christopher Newton
Rev 1.0 - 2/16/2020
)" << endl;
}// End of void splash_scrn(void)
void transition(void)
{
string resp = "XXX";
cout << " Press <ENTER> to Continue";
getline(cin, resp);
system("cls");
}// End of void transition(void)
void menu_scrn(string last, string first, string csid, string grade1,
string grade2, string grade3, string grade4, string grade5,
string grade6, char letter_grade)
{
string ans = "XXXX";
do
{
cout << endl << endl;
cout << " Miramar College" << endl;
cout << " STUDENT GRADE TRACKING SYSTEM" << endl;
cout << " ( Menu Screen )" << endl;
cout << endl << endl;
cout << endl;
cout << " _______________ Main Menu ______________ " << endl;
cout << " | |" << endl;
cout << " | Press <I> to input grades. |" << endl;
cout << " | |" << endl;
cout << " | Press <O> to output grade information. |" << endl;
cout << " | |" << endl;
cout << " | Press <E> to Exit program. |" << endl;
cout << " |________________________________________|" << endl;
cout << endl << endl << endl;
cout << " Press I, O, or E to continue!";
getline(cin, ans);
system("cls");
// End of Menu Screen
switch (ans.at(0)) // Start of switch
{
case 'I':
case 'i':
// Start of Input Screen
cout << endl;
cout << " Miramar College" << endl;
cout << " STUDENT GRADE TRACKING SYSTEM" << endl;
cout << " ( Input Screen )" << endl;
cout << endl;
cout << " ----------------------------------------------------------------------------- " << endl;
cout << endl;
cout << " Please press <ENTER> after inputting data";
cout << endl << endl;
cout << " Last Name: "; getline(cin, last);
cout << " First Name: "; getline(cin, first);
cout << endl;
cout << " Student ID Number (10-Digit): "; getline(cin, csid);
cout << endl;
cout << " ----------------------------------------------------------------------------- " << endl;
cout << endl;
cout << " Grade 1: "; getline(cin, grade1);
cout << " Grade 2: "; getline(cin, grade2);
cout << " Grade 3: "; getline(cin, grade3);
cout << " Grade 4: "; getline(cin, grade4);
cout << " Grade 5: "; getline(cin, grade5);
cout << " Grade 6: "; getline(cin, grade6);
cout << endl;
cout << endl;
// End of the Input Screen
// Transition to next screen
transition();
// End of transition
break;
case 'O':
case 'o':
// Start of Output Screen
output_scrn(last, first, csid, grade1, grade2, grade3, grade4, grade5, grade6, letter_grade);
// End of the Output Screen
// Transition to next screen
transition();
// End of transition
break;
case 'E':
case 'e':
break;
default:
error_scrn();
transition();
} // End of switch(resp.at(0))
} while (toupper(ans.at(0)) != 'E');
// End menu processing
}// End of void menu()
void output_scrn(string last, string first, string csid, string grade1,
string grade2, string grade3, string grade4, string grade5,
string grade6, char letter_grade)
{
// Variables from main() used for calculations
double grade1_num = atof(grade1.c_str());
double grade2_num = atof(grade2.c_str());
double grade3_num = atof(grade3.c_str());
double grade4_num = atof(grade4.c_str());
double grade5_num = atof(grade5.c_str());
double grade6_num = atof(grade6.c_str());
double Average = (grade1_num + grade2_num + grade3_num + grade4_num +
grade5_num + grade6_num) /
6.0;
{
if (Average > 100)
letter_grade = '+';
else if (Average >= 90)
letter_grade = 'A';
else if (Average >= 80)
letter_grade = 'B';
else if (Average >= 70)
letter_grade = 'C';
else if (Average >= 60)
letter_grade = 'D';
else if (Average >= 50)
letter_grade = 'E';
else if (Average >= 0)
letter_grade = 'F';
else
letter_grade = '-';
}
int ctr = 0;
cout << endl;
cout << " Miramar College" << endl;
cout << " STUDENT GRADE TRACKING SYSTEM" << endl;
cout << " ( Output Screen )" << endl;
cout << R"(
90 - 100 -> A
80 - 90 -> B
70 - 80 -> C
60 - 70 -> D
50 - 60 -> E
less than 50 -> F
----------------------------------
)";
cout << " Student Name (Last, First): " << last;
cout << " " << first << endl;
cout << " CSID: " << csid << endl;
cout << endl;
cout << " Grade 1: " << grade1 << endl;
cout << " Grade 2: " << grade2 << endl;
cout << " Grade 3: " << grade3 << endl;
cout << " Grade 4: " << grade4 << endl;
cout << " Grade 5: " << grade5 << endl;
cout << " Grade 6: " << grade6 << endl;
cout << endl;
cout << " Total Grade Average: " << Average;
cout << " Letter Grade: " << letter_grade << endl;
if (Average > 100) {
letter_grade = '+';
cout << " Error: Grade cannot be more than 100";
}
if (Average < 0) {
letter_grade = '-';
cout << " Error: Grade cannot be less than 0";
}
cout << endl;
}// End of void output()
void error_scrn(void)
{
cout << " " << endl;
cout << " " << endl;
cout << " Miramar College" << endl;
cout << " STUDENT GRADE TRACKING SYSTEM" << endl;
cout << " ( Error Screen )" << endl;
cout << " " << endl;
cout << R"(
________________________________________
/ Error: You entered the wrong key! Please \
\ press <Enter> and try again! /
----------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
)";
}// End of void error_scrn(void)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment