Froggy 000333443 90 Millenium_Teddy 342344118 90 StarBuck_Teddy 623434234 50 Gio
ID: 3615362 • Letter: F
Question
Froggy 000333443 90Millenium_Teddy 342344118 90
StarBuck_Teddy 623434234 50
Giorgio_Teddy 242344242 100
Lisa 23234234 60
pernard 534643332 100
Louisa 922313344 85
Charlie 89486484 60
Given the file "data txt", which holds student information ofthe type
froggy 000333443 90
- sort the student records according to their grade
-use structures and functions
NB: The number of records is stored in the first line of thefile
Explanation / Answer
please rate - thanks #include #include struct student{ char name[20]; char id[9]; int grade; } rec[10]; int input(struct student[]); void sort(struct student[],int); void print(struct student[],int); main() {int n; n=input(rec); if(n>=0) {printf("The records before sort: "); print(rec,n); sort(rec,n); printf(" The records after sort: "); print(rec,n); } getch(); return 0; } int input(struct student rec[]) {int n,i; FILE *in; if(!(in=fopen("data.txt","r"))) { printf(" Error opening input file "); return -1; } fscanf(in,"%d",&n); for(i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.