I have setup the basic functions for all the add/sub/mult/divide.
But now my assignment is telling me I need to create a bool handling whether whatever is entered is valid or not, which I'm having trouble with.
"Also write a function that reads in the operator and returns a boolean, true if the operator is valid, false if not valid. This function will have two parameters. First is a string of characters containing the valid operators. The second is a reference parameter where the operator will be placed if the operator entered is valid."
You mean you want to check if Op is in ValidOperators?
Why not just loop?
1 2 3 4 5
for(int i = 0; i < number_of_valid_operators; i++){//sizeof(ValidOperators) won't do here
//arrays are passed as pointers. you will have to use a constant
if(ValidOperators[i] == Op) returntrue;
}
returnfalse;