Question: guys correct me in this this program emust have 1 a readfile function and a menu function and a display function and a findaverage function
guys correct me in this
this program emust have
1 a readfile function and a menu function and a display function and a findaverage function
//101561731 //SWE20004 //LABTEST 2 //AUTHOR DINITHI WANNINAYAKA
#include
#include
using namespace std; struct student //defining the structure student { string name; int no_of_units;//maximum number of units limited to 5 int mark[5];//maximum size of this mark array for each student is 5 } int readFile(student s[]) //function for reading file in the array { ifstream input("grades.txt"); //opening the file in read mode int i=0; //for counting no of records in file while(!input.eof()) { input>>s[i].name>>s[i].no_of_units>>s[i].mark; //storing the information in array i++; //incrementing i by 1 } input.close(); //closing the file return i; //returning the number of records stored in array } void menu() //for displaying the menu { cout<<"(1) Display the grade details "; cout<<"(2) find the average of a student "; cout<<"(3) Enter -1 to Exit the program" int ch; cin>>ch; return ch; //returning the choise } void DisplayStudents(student s[],int ) //displaying the contents of the array on the screen {cout<<"\tName\t\tno_of_units\t\tMarks "; for(int i=0;i here is the input data Ricky 2 55 70 Alex 4 96 67 88 98 peter 3 45 37 61 joseph 5 98 56 100 87 77 Tyler 4 65 80 79 please reply for this as soon as possible , with possible outcomes Use the following structure for this task. struct student{ string name; int no_of_units; int mark; }; Declare an array named studentArray of the structure type shown above, the size of the array is limited to maximum 100.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
