Advertisement
Chieffo

Struktury

Nov 24th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. using namespace std;
  5.  
  6. struct osoba
  7. {
  8. string imie;
  9. string nazwisko;
  10. int wiek;
  11.  
  12. };
  13.  
  14.  
  15. int main()
  16. {
  17. int i=0;
  18. osoba uczniowie[5];//tablica ze struktury
  19. for (i=0;i<2;i++)
  20. {
  21. cin>>uczniowie[i].imie;
  22.  
  23. cin>>uczniowie[i].nazwisko;
  24.  
  25. cin>>uczniowie[i].wiek;
  26.  
  27.  
  28. }
  29.  
  30. for (i=0;i<2;i++)
  31. {
  32. cout<<"Imie:"<<uczniowie[i].imie<<endl;
  33. cout<<"Nazwisko:"<<uczniowie[i].nazwisko<<endl;
  34. cout<<"Wiek:"<<uczniowie[i].wiek<<endl<<endl;
  35. }
  36.  
  37. cout <<endl;
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement