Letzte Aufgabe

 avatar
unknown
c_cpp
5 months ago
750 B
11
Indexable
#include <iostream>
using namespace std;

int main() {
    
    double eingabe = 0;
    int auswahl = 0;
    double summe = 0;
    
    cout << "Ihre Eingabe: ? ";
    cin >> eingabe;
    cout << "\nIhre Auswahl der Umwandlung:" << endl;
    cout << " 1 – Celsius in Fahrenheit" << endl;
    cout << " 2 – Meter in Fuss" << endl;
    cout << " 3 – Euro in US Dollar\n";
    cin >> auswahl;
    
    double fahrenheit = eingabe*1.8 + 32;
    double fuss = eingabe*3.2808;
    double usDollar = eingabe*1.2957;
    //double summand = auswahl*(fahrenheit)+auswahl*(fuss)+auswahl*(usDollar);
    summe = (fahrenheit)*(auswahl == 1)+(fuss)*(auswahl == 2)+(usDollar)*(auswahl == 3);
    
    cout << "Das Ergebnis lautet: " << summe;

    return 0;
}
Editor is loading...
Leave a Comment