Question: #include #include #include using namespace std; class student { public: string year,um; int sid; float gpa; }; //function to read from file studentList.txt in struct

#include #include #include using namespace std;

class student { public: string year,um; int sid; float gpa; }; //function to read from file studentList.txt in struct student array //and return number of records presentin file int readData(student st[100]) { ifstream fin; int i=0; fin.open("StudentList.txt"); while(!fin.eof()) { fin>>st[i].sid; fin>>st[i].gpa; fin>>st[i].year; fin>>st[i].um; i++; } fin.close(); return(i-1); } //function to count and print number of students from each school //with GPA more than 4

void countTopper(class student st[100],int count) { int i,topper[4]={0,0,0,0}; for(i=0;i=4) topper[0]++; else if(st[i].um=="UMSL" &&st[i].gpa>=4) topper[1]++; else if(st[i].um=="UMKC" &&st[i].gpa>=4) topper[2]++; else if(st[i].um=="Mizzou" &&st[i].gpa>=4) topper[3]++; } cout<<" Number of students from each school with GPA >=4: "; cout<<" MST: "<=4) total++; } cout<<" Number of students with gpa more than 4 and attending their senior scho } //function to calculate mean gps of each year

void meanYearWise(class student st[100],int count) { int i,min=0,max=0; float total[4]={0,0,0,0},yearCount[4]={0,0,0,0},mean[4]; for(i=0;i

for(i=1;i<4;i++) { if(mean[min]>mean[i]) min=i; if(mean[max]

//main driver function

int main() { int i=0,count; class student st[100]; count=readData(st); cout<<"Total number of students: "<

This program when compiled is fine, but when i try to run it, Putty says "Segmentation fault(core dumped)"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!