Don't do that. It makes the code hard to read for others.
You should ask for the operation before calling
Operands()
. So move the call behind the input line.
It is also good style to pass the operation mode to the function and return the result rather than using global variables:
double Operands(char operation, double &n, double &d)
{
double result = 0.0;
switch (operation)
{
default:
cout << "Unknown operation " << operation << endl;
}
return result;
}
Than you can also remove the data input from this function.
Regarding fraction calculation see the
modf[
^] function.