Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4.  
  5. #define MAX 50
  6.  
  7. struct aluno {
  8. char nome[50];
  9. int matricula;
  10. float nota;
  11. };
  12.  
  13. void imprime(aluno v[], int num);
  14.  
  15. int main(void) {
  16. // Declara um aluno
  17. aluno alunos[MAX];
  18.  
  19. alunos[0].matricula = 12014432;
  20. alunos[0].nota = 7.5;
  21. strcpy(alunos[0].nome,"Fulano");
  22. alunos[1].matricula = 13022301;
  23. alunos[1].nota = 5.9;
  24. strcpy(alunos[1].nome,"Sicrano");
  25. alunos[2].matricula = 11024122;
  26. alunos[2].nota = 4.0;
  27. strcpy(alunos[2].nome,"Beltrano");
  28. alunos[3].matricula = 11014120;
  29. alunos[3].nota = 6.1;
  30. strcpy(alunos[3].nome,"Huguinho");
  31. alunos[4].matricula = 11024012;
  32. alunos[4].nota = 8.0;
  33. strcpy(alunos[4].nome,"Zezinho");
  34. alunos[5].matricula = 11014117;
  35. alunos[5].nota = 3.5;
  36. strcpy(alunos[5].nome,"Luizinho");
  37.  
  38. imprime(alunos, 6);
  39.  
  40. }
  41.  
  42. void imprime(aluno v[], int num) {
  43. int i;
  44.  
  45. for (i=0; i<num; i++) {
  46.  
  47. cout << "Mat.: " << v[i].matricula << endl;
  48. cout << "Nome: " << v[i].nome << endl;
  49. cout << "Nota: " << v[i].nota << endl;
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement