Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

13. You always should try to make a good first impression.

Answered: 1 week ago