1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
#include "stdafx.h"
#include <iostream>
#include <string.h>
#define UNICODE
#include <windows.h>
using namespace std;
int main(){
string resp = "y";
do{
long a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;
cout << "1)Add" << endl;
cout << "2)Subtract" << endl;
cout << "3)Multiply" << endl;
cout << "4)Divide" << endl << endl;;
cin >> a;
if (a == 1)
{
cout << "\nEnter a number to add.\n";
cin >> b;
cout << "Enter a second number to add.\n";
cin >> c;
d = b+c;
cout << endl << d << endl;
}
if (a == 2)
{
cout << "Enter a number to subtract.\n";
cin >> e;
cout << "Enter a second number to subtract.\n";
cin >> f;
g = e-f;
cout << endl << g << endl;
}
if (a == 3)
{
cout << "Enter a number to multiply.\n";
cin >> h;
cout << "Enter a second number to multiply.\n";
cin >> i;
j = h*i;
cout << endl << j << endl;
}
if (a == 4)
{
cout << "Enter a number to divide.\n";
cin >> k;
cout << "Enter a second number to divide.\n";
cin >> l;
m = k/l;
if (k < l)
{
MessageBoxA(NULL, L"You can't divide like that!", L"Error");
}
else
{
cout << endl << m << endl;
}
}
cout << "Anything more to calculate? (y/n)" << endl;
cin >> resp;
}
while (resp == "y");
do{
return 0;
}
while (resp == "n");
}
|