Advertisement
Guest User

Untitled

a guest
Mar 17th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class samochod
  6. {
  7. public:
  8. string marka;
  9. string model;
  10. int rocznik;
  11. int przebieg;
  12.  
  13. void wczytaj()
  14. {
  15. cout<<"Podaj marke auta: "<<endl;
  16. cin>>marka;
  17. cout<<"Podaj model auta: "<<endl;
  18. cin>>model;
  19. cout<<"Podaj rocznik auta: "<<endl;
  20. cin>>rocznik;
  21. cout<<"Podaj przebieg auta: "<<endl;
  22. cin>>przebieg;
  23. }
  24.  
  25. void wypisz()
  26. {
  27. if (marka=="audi") cout<<"Twoje auto to audi"<<cout<<"Model auta to: "<<model<<cout<<"Rocznik to: "<<rocznik<<cout<<"przebieg wynosi: "<<przebieg<<endl;
  28. else if (marka=="bmw") cout<<"Twoje auto to bmw"<<cout<<"Model auta to: "<<model<<cout<<"Rocznik to: "<<rocznik<<cout<<"przebieg wynosi: "<<przebieg<<endl;
  29. else if (marka=="tico") cout<<"Twoje auto to tico"<<cout<<"Model auta to: "<<model<<cout<<"Rocznik to: "<<rocznik<<cout<<"przebieg wynosi: "<<przebieg<<endl;
  30. }
  31.  
  32. };
  33.  
  34. int main()
  35. {
  36. samochod s1;
  37. s1.wczytaj();
  38. s1.wypisz();
  39.  
  40. samochod s2;
  41. s2.wczytaj();
  42. s2.wypisz();
  43.  
  44.  
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement