Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include #include using namespace std; const int SIZE=5; struct Student{ string name; string age; string score; string grade; string remark; }; int readFile(Student

image text in transcribed

#include #include #include #include

using namespace std; const int SIZE=5;

struct Student{

string name;

string age;

string score;

string grade;

string remark;

}; int readFile(Student sList[]){

fstream ifile;

ifile.open("data.txt",ios::in);

if (!ifile){

cout

return 0;

} cout

int i=0;

string temp1, temp2;

while (!ifile.eof()){

getline(ifile,sList[i].name); getline(ifile,sList[i].age); getline(ifile,sList[i].score); i++; }

} void dispAll(Student sList[], int nos){

for (int i=0; i

cout

cout

cout

char selection;

cout

cout

cin>>selection;

return selection;

}

void addStud(Student sl[],int &nos){ int i; cout>sl[i].name; cout>sl[i].age; cout>sl[i].score; nos++; makeSelection(); }

int main() {

Student studList[SIZE];

char selection;

int numOfStud=0;

do {

selection = makeSelection(); system("CLS");

switch(selection){

case 'a':{

cout

numOfStud= readFile (studList);

break;

} case 'c':{

cout

addStud(studList, numOfStud);

break; }

case 'd':{

cout

dispAll(studList, numOfStud);

break;

} default:{

cout

break;

} case 'x':{

cout

break;

}

}

cout

} while (selection !='x');

return 0;

}

'a' read input from file ' b ' calculate grade 'c' to add student 'd' to display all on sereen 'e' to display 1 student based on position 'f' to delete last student from list ' x ' to exit PLease enter your selection

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions