Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. struct tipoaluno {
  6.         float nota;
  7.         char nome [20];
  8.         char matricula [10];
  9.     };
  10.  
  11. int main()
  12. {
  13.     struct tipoaluno alunos[3];
  14.     int i;
  15.  
  16.     for (i=0; i<3; i++){
  17.         printf("\n Informe o nome do aluno:");
  18.         fgets(alunos[i].nome, 20, stdin);
  19.         setbuf(stdin,NULL);
  20.  
  21.         printf("\n Informe  a matricula:");
  22.         fgets(alunos[i].matricula, 10, stdin);
  23.         setbuf(stdin,NULL);
  24.  
  25.         printf ("\n Informe a nota:");
  26.         scanf("%f", &alunos[i].nota);
  27.         setbuf(stdin,NULL);
  28.     }
  29.  
  30.     for(i=0;i<3;i++){
  31.         printf ("\n\n O aluno %s, matricula: %s, obteve a nota: %.2f: ", aluno[i].nome, alunos[i].matricula, aluno[i].nota);
  32.     }
  33.  
  34.  
  35.  
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement