Advertisement
koassount

already pCodaz

Oct 12th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7.     bool weiter {true};
  8.     while (weiter) {
  9.    
  10.     double a,b;  //Seitenlängen des Rechtecks
  11.     cout << "Wie lang ist die Seite a des Rechtecks? \n";
  12.     cin >> a;
  13.     cout << "Wie lang ist die Seite b des Rechtecks? \n";
  14.     cin >> b;
  15.    
  16.    
  17.      if (a <= 0 || b <= 0)
  18.  
  19.         cout << "Seitelaengen koennen nicht  <=0 sein \n";
  20.        
  21.     else
  22.         cout << "Das Rechteck hat einen Umfang von: " << a*2+b*2 << " und eine Flaeche von: " << a*b << "\n";
  23.        
  24.     char antwort;
  25.    
  26.     cout << "Wollen Sie noch ene Berechung durchfueren? (j/n): ";
  27.    
  28.     cin >> antwort;
  29.    
  30.     weiter = antwort == 'j';
  31.  
  32.  
  33.  
  34.     }
  35.     system("PAUSE");
  36.    
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement