Advertisement
Guest User

klausur

a guest
Feb 9th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.33 KB | None | 0 0
  1.    
  2.  
  3.     #include <iostream>
  4.     using namespace std;
  5.      
  6.     struct rechteck
  7.     {
  8.             double kante1, kante2;
  9.     }
  10.     r1,r2; / //xburn: wozu ist das da ?
  11.      
  12.     int main()
  13.     {
  14.             double flaeche1,flaeche2,umfang1,umfang2;
  15.             cout << "Berechnung geometrischer Flaechen";
  16.             cout << endl;
  17.             cout << "=================================";
  18.             cout << endl;
  19.             cout << "Geben Sie die Daten von 2 Flaechen ein!";
  20.             cout << endl;
  21.  
  22.  
  23.         //xburn: bis hierhier ist nur pseudocode
  24.  
  25.             // Eingabe der Werte fürs Rechteck 1
  26.             cout << "Rechteck 1 Kante 1\t";
  27.             cin >> r1.kante1;               //xburn: warum wurde das hier z.b kombiniert ?
  28.             cout << "Rechteck 1 Kante 2\t";
  29.             cin >> r1.kante2;
  30.             cout << endl;
  31.            
  32.             // Eingabe der Werte fürs Rechteck 2
  33.             cout << "Rechteck 2 Kante 1\t";
  34.             cin >> r2.kante1;
  35.             cout << "Rechteck 2 Kante 2\t";
  36.             cin >> r2.kante2;
  37.             cout << endl;
  38.      
  39.      
  40.             // Ausgabe
  41.             cout << "Ausgabe";
  42.             cout << endl;
  43.             //Ausgabe der Fläche & Umfang vom Rechteck1
  44.             flaeche1 = r1.kante1 * r1.kante2;
  45.             umfang1 = (r1.kante1*2) + (r1.kante2*2);
  46.             cout << "Rechteck 1 hat die Flaeche: \t"<< flaeche1;
  47.             cout << endl;
  48.             cout << "Rechteck 1 hat den Umfang: \t"<< umfang1;
  49.             cout << endl;
  50.      
  51.             //Ausgabe der Fläche & Umfang vom Rechteck2
  52.             flaeche2 = r2.kante1 * r2.kante2;
  53.             umfang2= (r2.kante1*2) + (r2.kante2*2);
  54.             cout << "Rechteck 2 hat die Flaeche: \t"<< flaeche2;
  55.             cout << endl;
  56.             cout << "Rechteck 2 hat den Umfang: \t"<< umfang2;
  57.             cout << endl;
  58.      
  59.             //Vergleich der Flächen
  60.             if (flaeche1 > flaeche2)
  61.             {
  62.                     cout << "Flaeche von Rechteck1 ist groesser"<<endl;
  63.             }
  64.             else if (flaeche1 < flaeche2)
  65.             {
  66.                     cout << "Flaeche von Rechteck2 ist groesser"<<endl;
  67.             }
  68.             else if(flaeche1 == flaeche2)
  69.             {
  70.                     cout << "Keine Flaeche  ist groesser"<<endl;
  71.             }
  72.      
  73.             return 0;
  74.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement