My hw is: .....................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.
Operators List: + :add
- :subtract
* :multiply
/ :divide
c,C:clear data
x,X:exit program
This is what I got so far: Main.cpp
1. There's a stray ; in front of using in line 3.
2. The return type of main is incorrect, it must be int.
3. You should pass the length of the array to GetValidOp - or better yet, the operator list should only exist inside that function.
4. You're exiting the GetValidOp early if the first operator is not a valid one. The loop will never go beyond n=0.