victorialais

Struct de receber e imprimir nome, nota e matricula

Sep 4th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <math.h>
  4. using namespace std;
  5.  
  6. struct Aluno {
  7. string nome;
  8. float nota;
  9. int matricula;};
  10.  
  11.  
  12.  
  13. int main (){
  14. int y = 50, i;
  15. Aluno x[5];
  16. for (i=0; i<5; i++) {
  17.  
  18. cout << "Digite o nome: " << endl;
  19. cin >> x[i].nome;
  20. cout << "Digite a nota: " << endl;
  21. cin >> x[i].nota;
  22. cout << "Digite a matricula: " << endl;
  23. cin >> x[i].matricula;
  24. }
  25. for (i=0; i<5; i++) {
  26.  
  27. cout << "Nome " <<i+1 << " :"<< x[i].nome <<endl;
  28. cout << "Nota " <<i+1 << " :"<< x[i].nota <<endl;
  29. cout << "Matricula " <<i+1 << " :"<< x[i].matricula <<endl;
  30. }
  31.   return 0;
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment