Advertisement
jelenpivo123

programiranje2 yad4

Sep 23rd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <array>
  4.  
  5. using namespace std;
  6. int const VELICINA_NIZA = 3;
  7. struct Osoba{
  8.  
  9.  
  10. string ime;
  11. string prezime;
  12. string fakultet;
  13. int godinaStudija;
  14. string brojIndeksa;
  15.  
  16. };
  17.  
  18. int main()
  19. {
  20.  
  21. //kreiranje niza strukture
  22. Osoba o1[VELICINA_NIZA]; // svaki element ce imati osobine struct-a (ime,godine)
  23. //unos informacija
  24. cout<<"Unesite informacije o osobama: ime, prezime, fakultet, broj indeksa, godina studija " <<endl;
  25. for(int i=0; i<VELICINA_NIZA; i++){
  26. cout<<"Unesite ime osobe: " <<endl;
  27. cin>>o1[i].ime;
  28. cout<<"Unesite prezime osobe: "<<endl;
  29. cin>>o1[i].prezime;
  30. cout<<"Unesite fakultet osobe: "<<endl;
  31. cin>>o1[i].fakultet;
  32. cout<<"Unesite broj indeeksa osobe: "<<endl;
  33. cin>>o1[i].brojIndeksa;
  34. cout<<"Unesite godinu studija: "<<endl;
  35. cin>>o1[i].godinaStudija;
  36. }
  37. //prikazi informacija
  38. cout<<"Prikaz informacija osoba: "<<endl;
  39. for(int i=0; i<VELICINA_NIZA; i++){
  40. cout<<"Informacije osobe "<<(i+1)<<endl;
  41. cout<<"Ime: " <<o1[i].ime<<endl;
  42. cout<<"Prezime: " <<o1[i].prezime<<endl;
  43. cout<<"Fakultet: " <<o1[i].fakultet<<endl;
  44. cout<<"Broj indeksa: " <<o1[i].brojIndeksa<<endl;
  45. cout<<"Godina studija: " <<o1[i].godinaStudija<<endl;
  46.  
  47. }
  48.  
  49.  
  50. system("Pause");
  51. return 0;
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement