Guest User

Untitled

a guest
Jan 13th, 2018
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. struct ksiazka
  8. {
  9. string tytul;
  10. string autor;
  11. int rok;
  12. };
  13.  
  14. void wpisz(ksiazka N[3])
  15. {
  16. string a, b;
  17. int c;
  18. cout << "Podaj tytul, autora i rok ksiazki: " << endl;
  19. for(int i = 0; i<3; i++)
  20. {
  21. getline(cin, a);
  22. getline(cin, b);
  23. cin >> c;
  24. N[i].tytul=a;
  25. N[i].autor=b;
  26. N[i].rok=c;
  27.  
  28.  
  29. }
  30. }
  31.  
  32. void drukuj(ksiazka N[3])
  33. {
  34. cout << "Oto Ksiazki zapisane w bazie: " << endl;
  35. for(int i = 0; i<2; i++)
  36. {
  37.  
  38. cout << N[i].tytul << endl;
  39. cout << N[i].autor << endl;
  40. cout << N[i].rok << endl;
  41.  
  42. }
  43. }
  44.  
  45.  
  46. int main()
  47. {
  48. ksiazka K[3];
  49. wpisz(K);
  50. drukuj(K);
  51.  
  52. system("pause");
  53. return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment