0

This program is supposed to ask the user for 2 numbers first, then print out a menu asking which operation they would like to perform on the number, then output the result. the problem is, there needs to be a function for getting the numbers, functions for each operator, and another function to display the output. I am stuck in sending the numbers to the operators to perform the operation

```
#include <iostream>
using namespace std;
void menu(),choice(int ans);
double num();
double add();
void sub(),multi(),divi(),exit();
double res;
double num1;
double num2;
int main()
{
num();
menu();
return 0;
}
void menu()
{
int ans;
do
{
cout << "What would you like to do?\n";
cout << "1: Addition\n";
cout << "2: Subtraction\n";
cout << "3: Multiplication\n";
cout << "4: Division\n";
cout << "5: Exit\n";
cin >> ans;
choice(ans);
}while(ans!=5);
}
void choice(int ans)
{
switch (ans)
{
case 1:
result = add();
cout << "The answer is "<< result << "." << endl;
cout << "\n";
break;
case 2:
sub();
break;
case 3:
multi();
break;
case 4:
divi();
break;
case 5:
exit();
break;
default:
cout << "Please read and follow all directions\n";/
break;
}
}
double num()
{
double add;
double num1;
double num2;
cout << "First number? ";
cin >> num1;
cout << "Second number? ";
cin >> num2;
add = num1 + num2;
return add;
}
double add()
{
return result;
}
void sub()
{
}
void multi()
{
}
void divi()
{
}
void exit()
{
}
```