Untitled
unknown
plain_text
19 days ago
8.5 kB
1
Indexable
Never
#include <iostream> #include <string> #include <vector> using namespace std; int main() { string studentname1 = "", studentname2 = "", studentname3 = ""; float s1grade = 0, s2grade = 0, s3grade = 0; int record = 0, choice, question; int updatechoice, deletechoice, yesno; main: system("cls"); cout << "=====================================" << endl; cout << " Student Monitoring " << endl; cout << "=====================================" << endl; cout << " Current Record - " << record << endl; cout << "=====================================" << endl; cout << "1. Add Student (MAX - 3)" << endl; cout << "2. View Student Record" << endl; cout << "3. Update Student Record" << endl; cout << "4. Delete Student Record" << endl; cout << "5.Exit" << endl; cout << "=====================================" << endl; cout << " Student Monitoring " << endl; cout << "=====================================" << endl; cout << "Enter your Choice: "; cin >> choice; if (choice == 1) { if (record >= 3) { cout << "Max Student Reached" << endl; system("PAUSE"); system("cls"); goto main; } else { record++; if (record == 1) { system("cls"); cout << "Enter Student 1 Name: "; cin >> studentname1; cout << "Enter Student Grade: "; cin >> s1grade; } else if (record == 2) { system("cls"); cout << "Enter Student 2 Name: "; cin >> studentname2; cout << "Enter Student Grade: "; cin >> s2grade; } else if (record == 3) { system("cls"); cout << "Enter Student 3 Name: "; cin >> studentname3; cout << "Enter Student Grade: "; cin >> s3grade; } system("PAUSE"); system("cls"); goto main; } } else if (choice == 2) { system("PAUSE"); system("cls"); cout << "-----------------------------------------------------" << endl; cout << " Student Record " << endl; cout << "-----------------------------------------------------" << endl; cout << " 1. " << studentname1 << endl << "Grade: " << s1grade << endl; cout << "-----------------------------------------------------" << endl; cout << " 2. " << studentname2 << endl << "Grade: " << s2grade << endl; cout << "-----------------------------------------------------" << endl; cout << " 3. " << studentname3 << endl << "Grade: " << s3grade << endl; cout << "-----------------------------------------------------" << endl; system("PAUSE"); goto main; } else if (choice == 3) { system("PAUSE"); system("cls"); cout << "-----------------------------------------------------" << endl; cout << " Update Student Record " << endl; cout << "-----------------------------------------------------" << endl; cout << " 1. " << studentname1 << endl << "Grade: " << s1grade << endl; cout << "-----------------------------------------------------" << endl; cout << " 2. " << studentname2 << endl << "Grade: " << s2grade << endl; cout << "-----------------------------------------------------" << endl; cout << " 3. " << studentname3 << endl << "Grade: " << s3grade << endl; cout << "-----------------------------------------------------" << endl; cout << "\n"; cout << "Please Enter Which Student you want to Update: "; cin >> updatechoice; if (updatechoice == 1) { system("cls"); cout << "-----------------------------------------------------" << endl; cout << "Please Enter " << studentname1 << " Grade: "; cin >> s1grade; cout << "-----------------------------------------------------" << endl; system("PAUSE"); system("cls"); goto main; } else if (updatechoice == 2) { system("cls"); cout << "-----------------------------------------------------" << endl; cout << "Please Enter " << studentname2 << " Grade: "; cin >> s2grade; cout << "-----------------------------------------------------" << endl; system("PAUSE"); system("cls"); goto main; } else if (updatechoice == 3) { system("cls"); cout << "-----------------------------------------------------" << endl; cout << "Please Enter " << studentname3 << " Grade: "; cin >> s3grade; cout << "-----------------------------------------------------" << endl; system("PAUSE"); system("cls"); goto main; } } else if (choice == 4) { system("PAUSE"); system("cls"); cout << "-----------------------------------------------------" << endl; cout << " Delete Student Record " << endl; cout << "-----------------------------------------------------" << endl; cout << " 1. " << studentname1 << endl << "Grade: " << s1grade << endl; cout << "-----------------------------------------------------" << endl; cout << " 2. " << studentname2 << endl << "Grade: " << s2grade << endl; cout << "-----------------------------------------------------" << endl; cout << " 3. " << studentname3 << endl << "Grade: " << s3grade << endl; cout << "-----------------------------------------------------" << endl; cout << "\n"; cout << "Please Select Which Student Record Would you Like to Delete?" << endl; cout << "Enter your Choice: "; cin >> deletechoice; if (deletechoice == 1) { cout << "Are you Sure you Want to Delete " << studentname1 << " Record?"<< endl; cout << "1. Yes" << endl; cout << "2. No" << endl; cout << "Enter your Choice: "; cin >> yesno; if (yesno == 1){ studentname1 = ""; s1grade = 0; record --; goto main; } else if ( yesno == 2) { system ("PAUSE"); system ("cls"); goto main; } else { cout << "Invalid Choice." << endl; system ("PAUSE"); system ("cls"); goto main; } } else if (deletechoice == 2) { cout << "Are you Sure you Want to Delete " << studentname2 << " Record?"<< endl; cout << "1. Yes" << endl; cout << "2. No" << endl; cout << "Enter your Choice: "; cin >> yesno; if (yesno == 1){ studentname2 = ""; s2grade = 0; record --; goto main; } else if ( yesno == 2) { system ("PAUSE"); system ("cls"); goto main; } else { cout << "Invalid Choice." << endl; system ("PAUSE"); system ("cls"); goto main; } } else if (deletechoice == 3) { cout << "Are you Sure you Want to Delete " << studentname3 << " Record?"<< endl; cout << "1. Yes" << endl; cout << "2. No" << endl; cout << "Enter your Choice: "; cin >> yesno; if (yesno == 1){ studentname3 = ""; s3grade = 0; record --; goto main; } else if ( yesno == 2) { system ("PAUSE"); system ("cls"); goto main; } else { cout << "Invalid Choice." << endl; system ("PAUSE"); system ("cls"); goto main; } } else { cout << "Invalid Choice." << endl; system("PAUSE"); system("cls"); goto main; } } else if (choice == 5) { system("PAUSE"); system("cls"); char question; cout << "-----------------------------------------------------" << endl; cout << "are you sure you want to exit this program?" << endl; cout << " Y N " << endl; cout << "-----------------------------------------------------" << endl; cin >> question; if (question == 'Y') { goto exit; } else if (question == 'N') { goto main; } else { cout << "Invalid Choice." << endl; goto main; } } exit: system("PAUSE"); system("cls"); cout << "Thank you for using our program!" << endl; return 0; }
Leave a Comment