fork download
  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. using namespace std;
  5.  
  6. struct Agenda{
  7. char nome[50];
  8. int cod;
  9. };
  10.  
  11. int main()
  12. {
  13. Agenda a[3];
  14.  
  15. for(int i=0;i<3;i++){
  16. cout << "Nome: ";
  17. cin >> a[i].nome;
  18. cout << "Cód: ";
  19. cin >> a[i].cod;
  20. }
  21.  
  22. for(int i=0;i<3;i++){
  23. cout << a[i].nome << "\t" << a[i].cod << "\n";
  24. }
  25.  
  26.  
  27.  
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 15232KB
stdin
texto1
1111
texto2
2222
texto3
3333
stdout
Nome: Cód: Nome: Cód: Nome: Cód: texto1	1111
texto2	2222
texto3	3333