User should be able to choose whether they would like to add a new student or edit an existing student’s record. User should be able to save the edited document or discard changes.
Code:#include <iostream> #include <string> #include <fstream> #include <iomanip> using namespace std; int main() { string data; //For outputting data to te screen string firstName; //Student First Name string lastName; //Student Last Name string courseName; //Course Name int id; //Student I.D. Number int numCourse; //Number of courses int numGrades; //Number of grades to be entered double grade=0.00; //Separate Grade double totGrade=0.00; //Sum of Grades received double poss=0.00; //Possible Grade to be received in part. quiz double totPoss=0.00; //Total of possible marks double finGrade=0.00; //Final Grade double i=0.00; ofstream myfile; myfile.open("STUDRECORD.txt"); //ifstream yourfile; //yourfile.open("STUDRECORD.txt"); cout<<"Please enter student first name\n "; cin>>firstName; myfile<<firstName<<" "; cout<<"Please enter student last name\n "; cin>>lastName; myfile<<setw(5)<<lastName; cout<<"Please enter Identification Number\n"; cin>>id; myfile<<setw(12)<<id; cin.get(); cout<<"How many courses have you done?\n"; cin>>numCourse; for(int a=1;a<=numCourse;a++) { if (numCourse==a) { myfile<<"\t\t\t\t"; } cout<<"Please enter Course Name"<<endl; cin.get(); getline(cin, courseName, '\n'); myfile<<setw(20)<<courseName; cout<<"How many grades will you be entering for this course?"<<endl; cin>>numGrades; for(int i=0;i<numGrades;i++) { cout<<"Please enter quiz grade"<<endl; cin>>grade; myfile<<setw(6)<<grade; totGrade+=grade; cout<<"How much was this quiz out of?"<<endl; cin>>poss; totPoss+=poss; myfile<<"/"<<poss; } myfile<<"\n"; } finGrade=(totGrade/totPoss)*(100/1); return 0; }