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
|
#include <iostream>
#include <conio.h>
#include <windows.h>
#define NEWLINE '\n'
using namespace std;
int addition (int a, int b)
{
int r;
r=a+b;
return(r);
}
int subtraction (int a, int b)
{
int r;
r=a-b;
return(r);
}
int multiplication (int a, int b)
{
int r;
r=a*b;
return(r);
}
int division(int a, int b)
{
int r;
r=a*b;
return(r);
}
int main()
{
int a, b, z;
cout << "Enter two integers";
Sleep(1000);
cout << endl;
cout << NEWLINE;
cin >> a, b;
cout << NEWLINE;
cout << "For addition enter one, for subtraction two, for multiplication three and for division 4";
cin >> z;
cout << NEWLINE;
//this is the point where the program just ends without continuing on to the switch
switch (z){
case 1:
cout << addition(a,b);
getch();
break;
case 2:
cout << subtraction(a,b);
getch();
break;
case 3:
cout << multiplication(a,b);
getch();
break;
case 4:
cout << division(a,b);
getch();
break;
}
|