Guest User

Untitled

a guest
Feb 10th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. //CRechteck.cpp
  2. //Konstruktor
  3. CRechteck::CRechteck(){
  4.  
  5.     seite1 = 1;
  6.     seite2 = 1;
  7.  
  8. }
  9.  
  10.  
  11. void CRechteck::Ausgabe(double seite1, double seite2){
  12.  
  13.     cout << endl;
  14.     cout << "Der Flaecheninhalt betraegt: " << seite1*seite2 << endl;
  15.     cout << "Der Umfang betraegt: " <<  2*seite1+2*seite2 << endl;
  16.     cout << endl;
  17.  
  18. }
  19.  
  20. //Destruktor
  21. CRechteck::~CRechteck(){
  22.  
  23. }
  24.  
  25. //CRechteck.h
  26. class CRechteck{
  27.  
  28. private:
  29.     double seite1;
  30.     double seite2;
  31.  
  32.  
  33. public:
  34.  
  35.     CRechteck(); // Konstruktor
  36.     ~CRechteck(); // Destruktor
  37.  
  38.     void Ausgabe(double, double);
  39.    
  40. };
  41.  
  42. // main.cpp
  43. int main(){
  44.  
  45.     double x,y;
  46.  
  47.     CRechteck A;
  48.     cout << "Berechnung des Flaecheninhalts und Umfang eines Rechtecks" << endl << endl;
  49.     cout << "Seite 1 : "; cin >> x;
  50.     cout << "Seite 2 : "; cin >> y;
  51.     A.Ausgabe(x, y);
  52.  
  53.     system("PAUSE");
  54.  
  55.     return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment