Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class samochod
- {
- public:
- string marka;
- string model;
- int rocznik;
- int przebieg;
- void wczytaj()
- {
- cout<<"Podaj marke auta: "<<endl;
- cin>>marka;
- cout<<"Podaj model auta: "<<endl;
- cin>>model;
- cout<<"Podaj rocznik auta: "<<endl;
- cin>>rocznik;
- cout<<"Podaj przebieg auta: "<<endl;
- cin>>przebieg;
- }
- void wypisz()
- {
- if (marka=="audi") cout<<"Twoje auto to audi"<<cout<<"Model auta to: "<<model<<cout<<"Rocznik to: "<<rocznik<<cout<<"przebieg wynosi: "<<przebieg<<endl;
- else if (marka=="bmw") cout<<"Twoje auto to bmw"<<cout<<"Model auta to: "<<model<<cout<<"Rocznik to: "<<rocznik<<cout<<"przebieg wynosi: "<<przebieg<<endl;
- else if (marka=="tico") cout<<"Twoje auto to tico"<<cout<<"Model auta to: "<<model<<cout<<"Rocznik to: "<<rocznik<<cout<<"przebieg wynosi: "<<przebieg<<endl;
- }
- };
- int main()
- {
- samochod s1;
- s1.wczytaj();
- s1.wypisz();
- samochod s2;
- s2.wczytaj();
- s2.wypisz();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement