#include <iostream.h>
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <iomanip.h>
#include <string.h>
int main()
{
int keuze;
long num1;
long num2;
long som;
char yesno;
menu:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);
cout << "1. Rekenmachine" << endl;
cout << "2. Afsluiten" << endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_GREEN);
cout << "Maak uw keuze: " << endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_RED);
cout << "--> ";
cin >> keuze;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);
if(keuze==1){ goto calculator; }
if(keuze
==2){ goto
exit; } else {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_RED);
cout << "Ongeldige invoer!" << endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);
cerr << "Press any key to continue";
getchar();
goto menu; }
calculator: //########### REKENMACHINE!!
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);
cout << "Getal1: ";
cin >> num1;
cout << "Getal2: ";
cin >> num2;
cout << "Berekening (*, +, - of /):";
if(count=='*'){ som
= num1
* num2
; } if(count=='-'){ som
= num1
- num2
; } if(count=='/'){ som
= num1
/ num2
; }; if(count=='+'){ som
= num1
+ num2
; }
cout << "Uitkomst:" << endl;
cout
<< num1
<< " " << count << " " << num2
<< " = " << som
<< endl
<< endl
;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_GREEN);
cout << "Wilt u nog een berekening maken?" << endl << "[Y/N]: ";
cin >> yesno;
if(yesno=='y'){ goto calculator; }
if(yesno=='n'){ goto menu; }
else { goto confirm_calc; }
confirm_calc:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_RED);
cout << endl << endl << endl << "Ongeldige invoer!" << endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_GREEN);
cout << "Wilt u nog een berekening maken?" << endl << "[Y/N]: ";
cin >> yesno;
if(yesno=='y'){ goto calculator; }
if(yesno=='n'){ goto menu; }
else { goto confirm_calc; } //########### REKENMACHINE!!
return 0;
}