Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char keuze;
- float getal1 = 0, getal2 = 0;
- cout << "Dit is de mini-calculator!" << endl;
- cout << "Welke bewerking wil je uitvoeren?" << endl;
- cout << "1. Optelling <typ a>" << endl;
- cout << "2. Aftrekking <typ b>" << endl;
- cout << "3. Vermenigvuldiging <typ c>" << endl;
- cout << "4. Gehele deling <typ d>" << endl;
- cout << "5. Programma stoppen <typ q>" << endl;
- cin >> keuze;
- while(keuze != 'q')
- {
- cout << "Geef de waarde voor getal1: ";
- cin >> getal1;
- cout << "Geef de waarde voor getal2: ";
- cin >> getal2;
- switch (keuze)
- {
- case 'A':
- case 'a': cout << "Het resultaaat van de optelling is " << getal1 + getal2 << endl;
- break;
- case 'b':
- case 'B': cout << "Het resultaaat van de aftrekking is " << getal1 - getal2 << endl;
- break;
- case 'c':
- case 'C': cout << "Het resultaaat van de vermenigvuldiging is " << getal1 * getal2 << endl;
- break;
- case 'D':
- case 'd': cout << "Het resultaaat van de deling is " << getal1 / getal2 << endl;
- break;
- default: cout << "Ongeldige keuze." << endl;
- break;
- }
- cout << "Welke bewerking wil je uitvoeren?" << endl;
- cout << "1. Optelling <typ a>" << endl;
- cout << "2. Aftrekking <typ b>" << endl;
- cout << "3. Vermenigvuldiging <typ c>" << endl;
- cout << "4. Gehele deling <typ d>" << endl;
- cout << "5. Programma stoppen <typ q>" << endl;
- cin >> keuze;
- if(keuze == 'Q')
- {
- keuze = keuze +32;
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment