Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class produkt
- {
- public:
- double wartosc;
- double ciezar;
- double limit;
- string nazwa;
- double wyswietl();
- produkt(double w, double c, double l, string n);
- };
- produkt::produkt(double w, double c, double l, string n)
- {
- wartosc = w;
- ciezar = c;
- limit = l;
- nazwa = n;
- }
- double produkt::wyswietl()
- {
- cout << "Nazwa: " << nazwa << ", wartosc: " << wartosc << ", ciezar: " << ciezar << ", limit: " << limit << endl;
- }
- int main()
- {
- produkt p1(5,0.5,5,"maka");
- produkt p2(6,0.3,4,"kasza");
- produkt p3(2,1.5,15,"sol");
- produkt p4(10,1.2,10,"cukier");
- produkt p5(20,0.1,2.5,"herbata");
- p1.wyswietl();
- p2.wyswietl();
- p3.wyswietl();
- p4.wyswietl();
- p5.wyswietl();
- //cout << p1.nazwa << ", " << p1.ciezar << ", " << p1.limit << ", " << p1.wartosc << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement