0 like 0 dislike
6.1k views

Write a program with following requirements:

  • Define the structure type student with fields: name, code, and grade.
  • Write a function to sort the structures in grade ascending order and another function to display the data of the students who got a higher grade than the average grade of all students. If there is only 1 student in the list, display the data of that student.
  • Write a program that uses this type to read the data of 100 students and store them in an array of such structures. If the user enters the grade −1, the insertion of student data should terminate. Then print the data of the students who got a higher grade than the average grade of all students. 

 Example input:

Edgar
20161123
78
Robert
20161523
75
Rebecca
20166123
66
Todd
20161673
86
End
1
-1

Example output:

Students who got a higher grade than the average grade of all students:
Name: Edgar
Code: 20161123
Grade: 78
Name: Todd
Code: 20161673
Grade: 86

 

[Exercise] Coding (C) - asked in C
ID: 23560 - Available when: Unlimited - Due to: Unlimited
| 6.1k views
0 1
Called for Help
0 0
Called for Help
0 0
Called for Help

64 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>



struct student

{

char name[100];

int code;

int grade;



};





int average(struct student s[], int k)

{
* * ** * **** **** *** ** i;
* **** * ** * * * sum=0;
* * * * **** *** ** * ave;
** ** * ***** **** ** * * *** * **
** * * * * * ****
** *** *** *** ** ** *** *** * * *** * * *** * **
* ** * * **** * ** *** * * * ** * **** * *** = %d\n",sum);
* * *** *** ** *** ** *
** * *** ********* *** * *
* * **** * **** **** ** ave;

}



void sort(struct student s[],int k)

{
* *** ******** * ** ** * i,j;
** * * * ****** * * * ** *** = %d\n",k);
** * * * *** * * * ** student temp;
* *** ** ******* *** ***** * ***
* *** * * *** *
* **** ** * * ** * * * ** **** ** * **** * * **
* **** ** ** *** ** **** * * * * **
* **** * *** * ** * ** * * ** * * * ** * * * ****** ***** * ** * *** ** * ** *
* ** * * * * * * * * * * ** * ** ** * * * ******* ***
*** ******* * *** *** * **** * ** *** ** * **** * * * * * * ***** *** * ***** **** *** ** ** * * ***
* * ********* ** *** * ***** * *** ** * *** ** ** * *** * * **** ** ** ** * * * * ** **
* ******** * * *** ** * ** *** ** * * ** * * *** * * * * * ** *** * * * * *** * * * * ** **
* * ** ** **** ****** * ** * ** * * * * * * *
* **** ** ** * *** *** * ***** * * ***** ****
** * * * **** * ***

}





int main()

{

int i,k;

int ave;



struct student s[100];



for(i=0;i<100;i++)

{
** ** ** * ** ** *** ** ****** ** * * * *** *
* * *** * ** ** * ** * * * * ** ** * **** * * * *** **
* * * * * *** * * *** *** ** * ** ** ** * * ** *
* ***** ** ** *** ****** * * == -1)
* *** *** ** * ***** * *** * *** ** * **** * ** *

}

k=i;

//printf("k=%d\n",k);

sort(s, k);

ave=average(s,k);

printf("Students who got a higher grade than the average grade of all students:");



for(i=0;i<=k;i++)

{
* * * * * **** * * * *
** **** * * ** * ***
* * ** * ** *** *** *** ** * ** ** * * * ** ** * *** * * %s\n",s[i].name);
** ** ** * *** * * * * * ** ** * * **** * *** ** %d\n",s[i].code);
*** ** **** * * * **** ***** **** *** * * * * **** * ***** %d",s[i].grade);
* *** * * **** ***** **

}

return 0;

}
answered by (-226 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



struct student

{

char name[100];

int code;

int grade;



};





int average(struct student s[], int k)

{
** * * * * *** *** i;
* ********* * * * ** * ** sum=0;
* * * * * **** ave;
**** * * ** * ** * ** * * * ** **
*** * * * ***** * ** *
** * * * ** ** * ** *** ** * * * * ** ** * ** **
** * **** ** ** ****** **** * **** * * *** ** ** * * * ** * = %d\n",sum);
* *** ** ** * ***** *
** * ** * * * * ** * * **
* * * * *** ******* ** ave;

}



void sort(struct student s[],int k)

{
* * ** ***** * * ** * ** i,j;
* * ** * * ** * * ** ** *** ***** ** = %d\n",k);
** ** *** * *** ** * ** * * student temp;
** * **** ** * *** * * * *** **
***** ***** * * ******
* **** ***** ** **** **** * *** * * *** *** * * * * *
* ** ** * *** **** **** ** *** **** * ***
* * **** ** *** * * *** * * ** * * ** * **** * **** ******* ** *** * ** ** *
* * * * * * * * * ** * ** *** **** * * ** * *** ** ** ***** ***
* * ** ******** **** ** ** *** *** ** *** ** * * * * * * * ** **** * * **** *** *** ** * ** *****
** * * * * * * * * ** ** * * * ** ** **** * **** * ******* * * * * ** * * **
* * ** * * ** * ** ** * * ** * ******* * * *** * * * * *** * *** * *** * *** * ***
* ** * *** ** * ***** *** * * ***** **** ***** ** * * * *
******* * ** * *** * * * * * * * *** * *
* * * * * * * * *

}





int main()

{

int i,k;

int ave;



struct student s[100];



for(i=0;i<100;i++)

{
** ** * ** * ** * * ******* ** * * *****
** * ** *** * * *** * *** * * * * * * **
* ** * * * * * *** * * *** * * * ** *
*** * * *** * * ** * * * == -1)
* * *** * * * * ***** * ** * * ** **** * **** * * ** * *

}

k=i;

//printf("k=%d\n",k);

sort(s, k);

ave=average(s,k);

printf("Students who got a higher grade than the average grade of all students:");



for(i=0;i<=k;i++)

{
*** * **** * ***** ** ****** * ****
* * * * *** **** * ** ****
** * * ** * * ** * ** * * ***** * * ** ** * * * **** * %s\n",s[i].name);
* * ** * ** *** * ** ** * *** ** *** *** *** * **** * %d\n",s[i].code);
* * * * ** ** * * *** ** * ** * ** * * ** * ** * * %d",s[i].grade);
** ** * * ** * **** ****

}

return 0;

}
answered by (-226 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



struct student

{

char name[100];

int code;

int grade;



};





int average(struct student s[], int k)

{
* *** * *** * ** * ** i;
*** **** * * ** ** * *** *** sum=0;
*** ** * *** * * * * ave;
** ** ** *** *** * * *** ** * * *
*** * ** ** * * ****
* * * * ** ** *** * *** ***** * **** * * * ** * *
**** * * * * * *** * *** * * * **** ** * ***** = %d\n",sum);
* * ** * * * *** **
* *** ** ****** * *
* * * ***** * * **** **** ave;

}



void sort(struct student s[],int k)

{
* * *** * * * * * * * i,j;
* *** * ***** ** * * ** *** * * ***** = %d\n",k);
** * ** * ** *** ** *** student temp;
* ***** ** **** * *** *** *** *** *** ****
*** * * ** * * *
** ** * ******* ****** ** * * ** *** * * ********* * * ** * ***
* *** *** ** * ** ** * ** ****** * * * *
* * * * * * * ** ** ** * ** **** * * * ** *** * * * *** *** *** **** * *
** * *** * * * **** * *** * * ** * * ** ** * ** * ** *
* ***** ** * * * * * * ** * * * * * * ** * *** *** *** **** * * * ** *** *********
* * * * *** *** **** * *** *** ** *** ** ** * **** * **** * * ** * * *** *** ** * ****
**** **** *** **** * * * *** * ** **** *** ****** ** * * *** * **** ****
*** **** * * * ***** * *** ** * ***** ** * ** * ** * ***** *
***** ** * * * * *** *** **** * * * *
* * * * * ** *

}





int main()

{

int i,k;

int ave;



struct student s[100];



for(i=0;i<100;i++)

{
*** ** * ** * ** *** *** ** * * * **** ****** *
** * * ***** ***** ** ** * * * * * **** * ** * * * ** *****
** ** ** * *** *** **** * ** ** * ** * * ***
* * * * * *** * ** * == -1)
** ** ****** * **** ** **** *** * * ** * *** *****

}

k=i;

//printf("k=%d\n",k);

sort(s, k);

ave=average(s,k);

printf("Students who got a higher grade than the average grade of all students:");



for(i=0;i<=k;i++)

{
**** ** * ** ** **** *** * ** * **** *** *
** * * * **** ***
* ** * *** *** * * * ** * * ** * * ** * ** *** ****** %s\n",s[i].name);
****** * * ****** **** ** *** ** * * * * * ** ** * * * * %d\n",s[i].code);
** ** ** **** **** *** * * *** **** ** *** * * %d",s[i].grade);
** * *** * ** **** **

}

return 0;

}
answered by (-226 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



struct student

{

char name[100];

int code;

int grade;



};





int average(struct student s[], int k)

{
** * * *** * i;
** ** *** * * * * * * sum=0;
* * **** * * * * * ave;
**** ** * * ** ** * * * * * ******
* **** * ** ****** *** *
******* ** * * * *** ** *** * * *** ** ** * *
* * ** * * * * ** * * * * * * * * * * * ** * *** ** = %d\n",sum);
**** * ** * ** * **
* * ** * * *** ** **
*** * * * ******** ** * ave;

}



void sort(struct student s[],int k)

{
** * ****** ** * *** ** i,j;
* ** *** * ** *** ** * ** * * ** = %d\n",k);
** * ** ** * * * student temp;
* * **** ***** ***** ** * * * *
** ***** ** *** ** **
*** * * * ** * ** ** ** * * * ** *** *** * ** * * * ** *
* *** * * ** ******* ***** * **** ***
** ** * *** * * * *** * * *** * ***** ** ** * * * * * * * * ** * *
*** * * ** ** ** ** *** **** **** * * * ******** * ** ** * ** **** *
* * ** ** * * ** ** ** ** * **** * * ** * * * * *** * * *** * ** * * ** ***** **
***** ** * ** * ** ** * **** ** **** * * ** ** * ** ** ** ** *** * ** **** ***** ******* **
* * * *** ***** ******* ******* ******* * * ** * * * ***** *** *** * ** * * * * *
** **** **** * * * ** *** * * * * *** ** ***** ** * **** * ** *******
* ** ** *** *** * ** ** * * ** *** *
* ******* * * * ** *** *

}





int main()

{

int i,k;

int ave;



struct student s[100];



for(i=0;i<100;i++)

{
**** * * * * * *** ** * * ** * ** * * **
* **** *** * * ** * ** ***** ** ******** * **** **
***** ** ** * *** * ** * **** ** *** * * * **
* *** ** ** * * ** == -1)
**** * ** * ***** * *** * **** * * * * ** * *** *

}

k=i;

//printf("k=%d\n",k);

sort(s, k);

ave=average(s,k);

printf("Students who got a higher grade than the average grade of all students:");



for(i=0;i<=k;i++)

{
* * * **** * *** **** ** * * * ***
* ** * * ** * * **
* *** ** *** * * ** ** ** * * * * * * * * ** * * %s\n",s[i].name);
** ** * ****** ******* * * * * * ***** ** * %d\n",s[i].code);
* *** **** * ** ** ** * ** * **** *** * * ** %d",s[i].grade);
** * ** ******* * *

}

return 0;

}
answered by (-226 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



struct student

{

char name[100];

int code;

int grade;



};





int average(struct student s[], int k)

{
**** ** **** * * * i;
* * **** * ** ** * sum=0;
** *** ** * * * ** * ave;
* ** * * * *** * * ***** *** *** *
* * *** **** * * *********
* ** * *** *** *** **** * **** *** * ******* *** * **
* * * * *** **** ** * * * ** *** * * * * * * = %d\n",sum);
* ** ** *** * * *
* * *** * * ******* **
*** **** ** ** *** * **** ave;

}



void sort(struct student s[],int k)

{
* * ** ** * * *** ** i,j;
* * ** * * * ** ***** ** ***** = %d\n",k);
* ** * **** ** student temp;
* ** ** * * * ** ** ** *
** ** * * * **** * * **
**** ** * *** * *** *** * * *** * ** * * **** *****
* *** * * * ** * * * * * ** *
* ** ** *** *** *** *** * * * * * * *** ** * *** * ** ** **** *** * * *** * ** ** ** **
** ** * ** ** * ** * * ** * ***** * *** * * *** * * ** *** * *
** * *** ** **** *** * ***** **** *** * *** * ** **** * ******* * ** * ** * ****** * * ****
*** ** * * ** *** ** **** * ***** * *** * *** * *** ** * **** * * ** *** ** ** * ******* **** *
*** **** ** ** * ** * * * * ****** * * * * * * ** *** * * * * ***** * *** * ** *
** ** * * *** ** * * * * * *** * *** * * * * ** **** * ** * * *
* ** * ** *** *** * * * * ** ** *** **
* ** ** * * * * *

}





int main()

{

int i,k;

int ave;



struct student s[100];



for(i=0;i<100;i++)

{
*** * *** *** ** * *** * ***** ** * * * ** * * *
*** ******* * ** * * * *** *** *** * ** * * ******* *
* * * * * ** * * *** ** **** ** *** * **** ** * ** **
* * * * * * * * * * * ***** * * == -1)
** ** ** *** ***** ** ***** * * * * ***

}

k=i;

//printf("k=%d\n",k);

sort(s, k);

ave=average(s,k-1);

printf("Students who got a higher grade than the average grade of all students:");



for(i=0;i<=k;i++)

{
* **** *** *** ** ****** *** ****
** * ****** * * *** ** *
* * * ** *** *** *** ** * * * ** *** * * * %s\n",s[i].name);
* ** *** * * * * * *** * * * * * * ****** *** **** %d\n",s[i].code);
* * ** ** ** **** **** ** * ** *** * * * * *** * ** %d",s[i].grade);
* ** * * * ** ** * * *

}

return 0;

}
answered by (-226 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



struct student

{

char name[100];

int code;

int grade;



};





int average(struct student s[], int k)

{
* * * ** ** * ** i;
* *** ** **** ** * * * sum=0;
*** * ** * * * * *** * * * ave;
******* ** ** ** **** ** ** *** *** *
* ** * * * ***** **** ***
* * ******** ************ *** ** ** * ****** * * **** *** *
* *** ******* * *** * * * * *** * * * ***** * = %d\n",sum);
*** * *** ** ** * **** *
* * *** ** * **** *** ** ** * *** *
* ** * * * * ave;

}



void sort(struct student s[],int k)

{
** ** * * *** * * *** * i,j;
**** ** * * ****** ********** * ** ** * * = %d\n",k);
** ** ******* *** ** * * student temp;
* *** ** ** ***** **** ** ** * * ***
**** ******* * * ** * ** *
*** * * *** * * * ** * * * **** *** * **
* *** * * * ***** * * ****** * ** * **
* *** **** ** * *** * * * * * *** * * * * *** ******** * * ** *** ** * * *
* ** * * * ** *** * ******** * ** ** ** ** *** ** **** *** ***** *** **** * *** *
* * ** * ** ** * *** ** * ****** **** ***** ***** * * * ** ******* * ***** *** ** * * ** * * **
*** **** * ***** ** * ***** * * ** ** * * *** * ** * ** * * ** ** * * **** *** ** * ** **
**** ** * * *** *** * * *** ****** *** *** ** * * * * *** ****** ** * *** *
** ****** ** * ** *** ** **** ** *** *** ***** *** ** * ** * * ***
** * * ** *** * * ** **** * * **
* ** * * *****

}





int main()

{

int i,k;

int ave;



struct student s[100];



for(i=0;i<100;i++)

{
*** * * * * ** * **** ** * *** *
* * * ** * * **** * ***** ** ** ***
** * ******* * ** * **** ***** ****** * ** *** * **
* * * * * ***** * *** * == -1)
* **** * * ****** * **** ** * * * * ***

}

k=i;

//printf("k=%d\n",k);

sort(s, k);

ave=average(s,k-1);

printf("Students who got a higher grade than the average grade of all students:");



for(i=0;i<=k;i++)

{
* *** *** *** ** * ****** ***** **
* * ** **** *
* ** * * ** ***** * * * * * *** * *** * * *** * ***** * %s\n",s[i].name);
** * **** *** ** ****** * * * * * * * * ** ** ** *** * * %d\n",s[i].code);
** ** * ** * * ** * **** * **** * ** *** ** **** %d",s[i].grade);
***** ***** *

}

return 0;

}
answered by (-226 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



struct student

{

char name[100];

int code;

int grade;



};





int average(struct student s[], int k)

{
* **** * * * * * i;
* * ** * ** * **** * sum=0;
* * * *** * ** * * ave;
** *** *** ** ** ** * * ****
* * * * ** *****
* ** * *** * * * **** ** ****** * * * * *** **
* * **** * ** * * ** ** **** * * * * * * ** *** = %d\n",sum);
* * * ** **
* * ** **** **** * *
* *** ** *** * * ** **** ave;

}



void sort(struct student s[],int k)

{
***** * ***** * *** ** * i,j;
* * * * * * ***** ** ** ** ** = %d\n",k);
*** * * ***** **** *** * student temp;
* **** * *** * * *** **
** ** * ** * ******
****** ***** * ** ***** * **** * ** * ** ******* * * ** * *
* * *** ** * ** * **** * ** * * **** *** *********
* * * * **** * * ** ******* * **** * *** **** * ** ** ** * * * ** ** * * **** *
* *** * *** * * ** ** **** ** ** ** * ** * * *** *** ** ** *
** ****** * ** ** * ***** **** * * *** ** * * * *** ** **** **** * ** *** ** * ***
** *** * * ** * ** ** * * ** * *** *** * * * *** * **** * ** * ** ** ** ***** * ** * * ** ** * *********
** ** ** ** ** * * * ***** ** * **** * * * * *** ** * * * ** * * * ***** * **** * * ** **
** ** * *** *** ** ** * * * * * * * * ** ** * **** ** * **** *
*** *** * *** * ***** * ** ** *** ** **
*** * ***** ** * ** *

}





int main()

{

int i,k;

int ave;



struct student s[100];



for(i=0;i<100;i++)

{
* **** * ****** * * ** * * ***** ** * ***** ** *
** * * **** * **** **** * ** * ***** *** *** *** **
* * * *** * * * ** *** * * * ** * *** * * * ***** ****
** * * ** * ** ** *** * * == -1)
* * * * ** * **** * *** * * * * ** * * *

}

k=i;

//printf("k=%d\n",k);

sort(s, k);

ave=average(s,k-1);

printf("Students who got a higher grade than the average grade of all students:");



for(i=0;i<=k;i++)

{
* ** ** **** * * ****** * * *
* * * *** * * * **** * ** **
** * ** * * ** * ** ** * * * * * * ** ** *** %s\n",s[i].name);
** * ** **** * **** * * ***** ** * *** ** * * * %d\n",s[i].code);
*** **** * *** * ** * ** ** *** * ** *** * *** * ** * ** * **** %d",s[i].grade);
** ** ** * ** * ** * *

}

return 0;

}
answered by (-226 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



struct student

{

char name[100];

int code;

int grade;



};





int average(struct student s[], int k)

{
***** **** * * * ** ** i;
*** * *** * ** * * * sum=0;
*** ** *** **** * * * ave;
* * * * *** * ** * * * *** * **
*** *** **** * *
* * * * * ** ** * ** ** * ** ****** * *** *
* * ****** * * **** * * * * ** * *** ** ** * * * * * * ** = %d\n",sum);
* ** ** * *** * * * **
***** * **** * ** ** * ** *
* *** * ** * ** * * * ave;

}



void sort(struct student s[],int k)

{
** * * * *** * ** i,j;
** ***** ****** **** *** ***** = %d\n",k);
** * * * ** ** * ** * * student temp;
* * ** ** * * * * * **** * * * ** *
* ** * *** * *** * *
************ * *** * ** * *** * * ** * ** * *** ** * ** **** * *
*** **** * ** * **** ****** * * ***** * * * *
***** ****** * ** **** ** ****** * * *** ** ** * ** * ****** * * ***** * ** *
* *** * * ** ** ***** * *** * * **** ******** * * ** * * ***
* * ** **** ** * ** * * **** *** *** ** * ** **** ** *** ** *** * * * * * * *
** *** * **** *** ** * *** *** *** * * *** * ** ** ** * * * * ** *** **** ******* *
* * * ** *** * * ** ** * * *** ******* * * ***** * * ** **** ** *** * * ** ** ** * **
* ** * ** ** * * * * ** ******* * * * * * * *** * ** **
**** *** *** *** * * ** ***** *** * ****** *
** *** * * ******

}





int main()

{

int i,k;

int ave;



struct student s[100];



for(i=0;i<100;i++)

{
* ** * * **** ** * **** *** ** *** * ** * ******
*** *** *** **** * ** ***** ** * ** * *
** * **** ** ****** * ****** * *** * * ****
*** * **** *** *** * ** ****** == -1)
** * * * * ***** *** ** ** *** * ** ** ** *

}

k=i;

//printf("k=%d\n",k);

sort(s, k);

ave=average(s,k-1);

printf("Students who got a higher grade than the average grade of all students:");



for(i=0;i<=k;i++)

{
* * * ** ***** ****** * *
* ** * * * ** * *
**** * * * ****** ** * ******* ** *** * * *** **** ** %s\n",s[i].name);
* * **** ** * ********** * * *** *** * * * * **** %d\n",s[i].code);
*** * *** *** * * *** *** * * * **** * * ***** * **** %d",s[i].grade);
** ** * ***** *****

}

return 0;

}
answered by (-226 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



struct student

{

char name[100];

int code;

int grade;



};





int average(struct student s[], int k)

{
* * * * *** *** * i;
* * * ** * * ** * ** * sum=0;
****** * *** * * ** ave;
* ** * *** * ** ** ****** ** * * * *
* * ** * * ** **
* ** *** *** * * * *** ** ** ** * * * * * **
*** **** * * *** ****** ** ** * * * * *** * = %d\n",sum);
* ** *** ** ** * *****
** * ****** * * *** ** *
* ** * ** * ** ** * *** ave;

}



void sort(struct student s[],int k)

{
* ** * * * * * * * * i,j;
********* * * * *** * * * * ** *** = %d\n",k);
* *** * ** * * * * ** **** * student temp;
* *** * * * * * * * * ** *
* ** ** *** **** ** * ****
****** * * ***** * **** * * * * * **** * ** * **** *** * ** *
** **** * * * *** * ** * * ** * * *
* ** * * * ** ** ******* *** * * ******** ** ** *** * * ***** * *** ** **** **
** * ** * ** ** * * * ** *** *** * * *** * * * *** ** *
* * * * ***** ** * ** ** ********* * ** * *** ***** *** * *** * ***** ** ** * **** *** * *
***** ** * ****** ** *** * * ** * * * * * * ** * * *** * * ** ** * ** ** ** * * ** * **** * *
* *** ** * * * * ***** * ** *** *** * * * ** *** * ** * *** ** * * ** ******* *** *
* * * ** * *** * ** ** * ** ***** * ** ** * ** * * ** **** **
* *** * * *** ** **** ******* ** *******
***** ** ******* * *

}





int main()

{

int i,k;

int ave;



struct student s[100];



for(i=0;i<100;i++)

{
* ******* * * ** * **** * ** **** * ** ** *
*** * * * * *** *** ** * ** * *** *
**** ** * * * ** *** *** * * ** * * * * **** * ****
** * * ** *** ** * * * == -1)
* *** * * ********** ** * * * * * *** ***

}

k=i;
* **** * ** * * * *

sort(s, k);

ave=average(s,k-1);

printf("%d Students who got a higher grade than the average grade of all students:",ave);



for(i=0;i<=k;i++)

{
* *** ***** *** *** **** * *** **
* * **** ** **
* * * ** * * ** *** * * * ** *** * * * * * * %s\n",s[i].name);
***** * * * ** * * **** ** * ***** * ** * *** * **** * %d\n",s[i].code);
* * **** * * *** ** * ** * ** *** ** ** %d",s[i].grade);
*** ** **** * *

}

return 0;

}
answered by (-226 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



struct student

{

char name[100];

int code;

int grade;



};





int average(struct student s[], int k)

{
* * * ** *** * * * * ** i;
** *** ** ****** ** * sum=0;
*** * * **** ave;
* * ** * ** *** * * ** *
* ** **** * ***
* ** ** * *** * * ****** * *** *** *** ** ***
* * * ***** * **** ***** * * ** ** *** *** **** ** ** * = %d\n",sum);
** * ** * *** *
* ********** ** * *** ** ***
* * ** **** *** * ** ave;

}



void sort(struct student s[],int k)

{
* * * ** ****** * **** i,j;
***** *** *** * ***** * ** * ******* * = %d\n",k);
**** *** ** * * * * * student temp;
**** **** * * * ** * * *** * ** ** *
* ** ***** * * * * *****
* * * **** *** *** * * **** * ** * ** * *** ******** *
* ** * *** *** ** * ** ** *** ** * ** **
** * * ** * * ** * * *** * ** **** * * * * * ** * * * * ***** ** * * ***** * * * **
* * ** * *** * ** * *** * *** *** * *** * ** **** ** ** ***
*** * *** * * * * ** ** * **** * * * * * ********* * ***** * * **** * *** * *** * ** ******* ** **
* * * * * *** * ** * * **** ** * *** * ** ** * ** ***** * * * **** ** **** * ** **
** * **** * * * **** ** **** * ********* * *** **** * * ****** * ** ** ****** ** **
* * *** * *** *** * *** *** * **** *** * * * * ***** * * ** ** **
* ** * ** * *** * *** * *** * **
** *** *** * * * **

}





int main()

{

int i,k;

int ave;



struct student s[100];



for(i=0;i<100;i++)

{
** * ** * **** * ** * * * ** ***** *** *
* ** *** ** * * * * ** * * ** * *** ** *
** ***** **** ** * **** ** ***** * * * **** * ** *
** * * ** * * * * **** == -1)
* * * * * * * ***** * * * ***** *** ** ** * * *

}

k=i;
**** ** *** * ***

sort(s, k);

ave=average(s,k);

printf("%d Students who got a higher grade than the average grade of all students:",ave);



for(i=0;i<=k;i++)

{
* ***** ** * ********** *** **** *
* ** ** ** * *** ****
*** *** ** ** **** **** ** * *** * ******* ** * ** *** %s\n",s[i].name);
** * ** * * *** * * **** * * *********** *** *** ** %d\n",s[i].code);
* * * *** * ** * * **** *** * **** * * ****** * ** ** ** * %d",s[i].grade);
* ****** *** ** * ****

}

return 0;

}
answered by (-226 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.7.247
©2016-2025

Related questions

0 like 0 dislike
32 answers
[Exercise] Coding (C) - asked Apr 6, 2017 in C
ID: 23557 - Available when: Unlimited - Due to: Unlimited
| 3.4k views
0 like 0 dislike
18 answers
[Exercise] Essay (Open question) - asked Apr 20, 2017 in C
ID: 24219 - Available when: Unlimited - Due to: Unlimited
| 2.5k views
12,783 questions
183,442 answers
172,219 comments
4,824 users