Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAXSTU 5
- #define MAXNAME 40
- struct Student {
- char name[MAXNAME];
- float med;
- };
- int main() {
- int i, BiggerIndex;
- float BiggerMed = 0;
- struct Student StudentInfo[MAXSTU];
- for (i = 0; i < MAXSTU; i++) {
- printf("Entre com o nome do estudante :\n");
- fflush(stdin);
- gets(StudentInfo[i].name);
- printf("Entre com a media :\n");
- scanf("%f",&StudentInfo[i].med);
- if (StudentInfo[i].med > BiggerMed) {
- BiggerMed = StudentInfo[i].med;
- BiggerIndex = i;
- }
- }
- printf("Aluno com a media : %s\n",StudentInfo[BiggerIndex].name);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment