What I'm trying to do is create a program that lets a user enter two numbers (floating point) and a symbol (+, -, * or /) and then calculates the answer. The only trouble I'm running into (I believe) is storing a character as a "char" variable. Any help would be appreciated!
You are trying to pass 2 functions to an void function which only accepts one argument?
I don't know why you are trying to do everything in seperate functions, if this is an assignment I can work out a reply for you using functions but.. you can do all of this without any excess fucntions.
I used a switch case but if/else works fine as well.
Actually now I'm coming up with another error that's saying expected ')' before '+' and it's saying it for each operation.
As before, this Solution(x '+' y); doesn't compile. Two doubles with a char in the middle is not a valid expression.
However, this is a valid expression Solution(x + y);. If you get rid of the single quotes in each of the similar statements (turning the middle char into an operator), then it will work. Also, be sure for Solution to take in a double instead of an int.
Oh, I see. I had been told it's best to split everything up that way, so I was practicing that, but I guess that's not something you should always follow.
It's working fine for me now, thanks for the help guys =) and nice catch with the "solution" there shacktar, I don't know why I had int.