mirror of
https://github.com/szymon-jozef/ZUT-notatki.git
synced 2026-10-28 11:10:38 +01:00
kod
This commit is contained in:
@@ -1,3 +1,21 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
int main() {}
|
||||
class Produkt {
|
||||
std::string nazwa;
|
||||
float cena;
|
||||
|
||||
public:
|
||||
void ustawNazwe(std::string nazwa) { this->nazwa = nazwa; }
|
||||
void ustawCene(float cena) { this->cena = cena; }
|
||||
void pokaz() {
|
||||
std::cout << "Produkt " << nazwa << " kosztuje " << cena << " zł.";
|
||||
}
|
||||
};
|
||||
|
||||
int main() {
|
||||
Produkt p;
|
||||
p.ustawNazwe("Marchewka");
|
||||
p.ustawCene(234.342);
|
||||
p.pokaz();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user