Advertisement
programusy

Untitled

Mar 16th, 2023
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class samochod{
  6. public:
  7. string nazwa_marki;
  8. double poj_silnika;
  9. int ilosc_osob;
  10.  
  11. samochod(){}
  12.  
  13. samochod(string nzw, double poj,int il)
  14. {
  15. nazwa_marki = nzw;
  16. poj_silnika = poj;
  17. ilosc_osob = il;
  18. }
  19. };
  20.  
  21. ostream &operator<<(ostream &out, samochod u){
  22. out <<"marka: " << u.nazwa_marki << endl << "pojemnosc: " << u.poj_silnika << endl << "ilosc osob: " << u.ilosc_osob;
  23. return out;
  24. }
  25.  
  26. int main()
  27. {
  28. samochod a();
  29. samochod b("Honda",2.1,3);
  30.  
  31. cout << "samochod 0 argumentowy: " << endl;
  32. cout << a << endl;
  33.  
  34. cout << endl;
  35.  
  36. cout << "samochod 3 argumentowy: " << endl;
  37. cout << b << endl;
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement