Advertisement
programusy

Untitled

Apr 12th, 2023
18
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 produkt
  6. {
  7. public:
  8. double wartosc;
  9. double ciezar;
  10. double limit;
  11. string nazwa;
  12.  
  13. double wyswietl();
  14. produkt(double w, double c, double l, string n);
  15. };
  16.  
  17. produkt::produkt(double w, double c, double l, string n)
  18. {
  19. wartosc = w;
  20. ciezar = c;
  21. limit = l;
  22. nazwa = n;
  23. }
  24.  
  25. double wyswietl()
  26. {
  27. cout << wartosc << ciezar << limit << nazwa;
  28. }
  29.  
  30. int main()
  31. {
  32. produkt p1(5,0.5,5,"maka");
  33. produkt p2(6,0.3,4,"kasza");
  34. produkt p3(2,1.5,15,"sol");
  35. produkt p4(10,1.2,10,"cukier");
  36. produkt p5(20,0.1,2.5,"herbata");
  37.  
  38. p1.wyswietl();
  39. //cout << p1.nazwa << ", " << p1.ciezar << ", " << p1.limit << ", " << p1.wartosc << endl;
  40. return 0;
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement