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 <string>
using namespace std;
//------Function prototypes---------|
void add ( int numb1, int numb2);
void subtract (int numb1, int numb2);
void multiply (int numb1, int numb);
void divide (int numb1, int numb2);
int main()
{
int numb1;
int numb2;
string operation;
cout << "Enter the first number and then the second number" << "\n";
cin >> numb1;
cin >> numb2;
cout << "Select the type of operation you want to do: add, subtract, multiply, or divide" << "\n";
cin >> operation;
if(operation == "add")
{
void add (int numb1, int numb2);
}
else if(operation == "subtract")
{
void subtract (int numb1, int numb2);
}
else if (operation == "multiply")
{
void multiply (int numb1, int numb2);
}
else if (operation == "divide")
{
void divide (int numb1, int numb2);
}
return 0;
}
//------------------------Arithmetic functions----------------------|
void add (int numb1, int numb2)
{
cout << numb1 << "+" << numb2 << "=" << numb1 + numb2;
}
void subtract (int numb1, int numb2)
{
cout << numb1 << "-" << numb2 << "=" << numb1 - numb2;
}
void multiply (int numb1, int numb2)
{
cout << numb1 << "*" << numb2 << "=" << numb1 * numb2;
}
void divide (int numb1, int numb2)
{
cout << numb1 << "/" << numb2 << "=" << numb1 / numb2;
}
|