Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.40 KB | None | 0 0
  1. #include <conio.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     const int iBio = 5;
  8.     const int iGeringerVerbrauch = 5;
  9.     const int iPreis = 15;
  10.     int iJahresverbrauch;
  11.     float fTagesverbrauch;
  12.     bool bBio;
  13.  
  14.     cout << "Wie hoch ist ihr jaehrlicher Verbrauch: ";
  15.     cin >> iJahresverbrauch;
  16.     fTagesverbrauch = (float)iJahresverbrauch/365;
  17.     cout << endl << endl << "Jahresverbrauch: " << iJahresverbrauch << endl << "Tagesverbrauch: " << fTagesverbrauch;
  18.  
  19.     cout << endl << endl << "Nutzen sie Oekostrom?: ";
  20.     cin >> bBio;
  21.  
  22.     if(iJahresverbrauch < 10000 && !bBio)
  23.     {
  24.         float iErgebnis = (float)iJahresverbrauch * ((float)iPreis + (float)iGeringerVerbrauch);
  25.         cout << endl << endl << "Ihre jaehrlichen Stromkosten betragen: " << iErgebnis;
  26.     }
  27.     else if(iJahresverbrauch >= 10000 && !bBio)
  28.     {
  29.         float iErgebnis = (float)iJahresverbrauch * (float)iPreis;
  30.         cout << endl << endl << "Ihre jaehrlichen Stromkosten betragen: " << iErgebnis;
  31.     }
  32.     else if(iJahresverbrauch < 10000 && bBio)
  33.     {
  34.         float iErgebnis = (float)iJahresverbrauch * ((float)iPreis + (float)iGeringerVerbrauch + (float)iBio);
  35.         cout << endl << endl << "Ihre jaehrlichen Stromkosten betragen: " << iErgebnis;
  36.     }
  37.     else if(iJahresverbrauch >= 10000 && bBio)
  38.     {
  39.         float iErgebnis = (float)iJahresverbrauch * ((float)iPreis + (float)iBio);
  40.         cout << endl << endl << "Ihre jaehrlichen Stromkosten betragen: " << iErgebnis;
  41.     }
  42.  
  43.     getch();
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement