I'm trying to do a calculator type thing to practice with functions (I'm a beginner) and for the user to use, addition, subtraction, mult. or division the user has to choose a mode which is the job of the variable mode so I used cin so the user can enter a number. but once the user chooses the mode then the user would need to input the values but to do that i would need to use cin again, but the screen where the user inputs the value doesn't appear. what should I do? (this is not complete)
#include <iostream>
using namespace std;
double mode4 (double x, double y){
double sum;
sum = x + y;
cout << "sum is: " << sum <<endl;
return 0;
}
int main() {
int *mode = new int;
cin >> *mode;
if (*mode > 4 || *mode == 0){
*mode = 4;
}
if (*mode == 4){
double num1;
double num2;
cin >> num1 >> num2;
mode4(num1, num2);
delete mode;
}
cout << *mode << endl;
return 0;
}