Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //CRechteck.cpp
- //Konstruktor
- CRechteck::CRechteck(){
- seite1 = 1;
- seite2 = 1;
- }
- void CRechteck::Ausgabe(double seite1, double seite2){
- cout << endl;
- cout << "Der Flaecheninhalt betraegt: " << seite1*seite2 << endl;
- cout << "Der Umfang betraegt: " << 2*seite1+2*seite2 << endl;
- cout << endl;
- }
- //Destruktor
- CRechteck::~CRechteck(){
- }
- //CRechteck.h
- class CRechteck{
- private:
- double seite1;
- double seite2;
- public:
- CRechteck(); // Konstruktor
- ~CRechteck(); // Destruktor
- void Ausgabe(double, double);
- };
- // main.cpp
- int main(){
- double x,y;
- CRechteck A;
- cout << "Berechnung des Flaecheninhalts und Umfang eines Rechtecks" << endl << endl;
- cout << "Seite 1 : "; cin >> x;
- cout << "Seite 2 : "; cin >> y;
- A.Ausgabe(x, y);
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment