Guest User

Untitled

a guest
May 17th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Zwierze
  5. {
  6. public:
  7. //atrybuty
  8. string gatunek;
  9. string imie;
  10. int wiek;
  11. //metody
  12. void dodaj_zwierze()
  13. {
  14. cout << "dodawanie nowego zwierzecia do bazy\n";
  15. cout << "Podaj gatunek: ";
  16. cin >> gatunek;
  17. cout << "Podaj imie: ";
  18. cin >> imie;
  19. cout << "Podaj wiek: ";
  20. cin >> wiek;
  21. }
  22.  
  23. void daj_glos()
  24. {
  25. if (gatunek == "kot") cout << imie << " lat" << wiek << ": Miau";
  26. else if (gatunek == "koza") cout << imie << " lat" << wiek << ": BEEE";
  27. else if (gatunek == "krowa") cout << imie << " lat" << wiek << ": Muu";
  28. else cout << "gatunek nieznany";
  29. }
  30. };
  31.  
  32. int main() {
  33.  
  34. Zwierze z1;
  35.  
  36. z1.dodaj_zwierze();
  37. z1.daj_glos();
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment