-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuebung2.cpp
More file actions
39 lines (33 loc) · 748 Bytes
/
Copy pathuebung2.cpp
File metadata and controls
39 lines (33 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
class Haus {
private:
int tueren;
int fenster;
int mauern;
public:
Haus() {
tueren = 0;
fenster = 0;
mauern = 0;
}
void baueHaus(int t, int f, int m) {
tueren = t;
fenster = f;
mauern = m;
}
void anzeigen() {
std::cout << "Das Haus hat "
<< tueren << " Türen, "
<< fenster << " Fenster und "
<< mauern << " Mauern.\n";
}
};
int main() {
Haus meinHaus1;// EIN Haus
int tueren_anzahl=2;
int fenster_anzahl=3;
int mauern_anzahl=16;
meinHaus1.baueHaus(tueren_anzahl, fenster_anzahl, mauern_anzahl); // Eigenschaften setzen
meinHaus1.anzeigen(); // anzeigen
return 0;
}