Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Samochod{
- public:
- string nazwa_marki;
- double pojemnosc_silnika;
- int ilosc_osob;
- Samochod() {
- nazwa_marki = "";
- pojemnosc_silnika = 0;
- ilosc_osob = 0;
- }
- Samochod(string marka, double pojemnosc, int ilosc) {
- nazwa_marki = marka;
- pojemnosc_silnika = pojemnosc;
- ilosc_osob = ilosc;
- }
- void pokaz() {
- cout << "Marka= " << nazwa_marki << endl;
- cout << "Pojemnosc silnika= " << pojemnosc_silnika << " L" << endl;
- cout << "Ilosc osob= " << ilosc_osob << endl;
- }
- };
- int main() {
- Samochod auto1;
- auto1.pokaz();
- Samochod auto2("Ford", 2.0, 5);
- auto2.pokaz();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement