I am trying to make a calculator code using switch statements. There are many different arithmetic operators but when I use the pow function with integer numbers no matter what, it outputs "1". Please Help.
You should run your program and try to fix the errors and warnings .
Lines 8, 9 and 10 define 3 variables that are uninitialized and contain garbage values.
Line 11 calls the "std::pow" function with the garbage values, so you may be lucky that you are getting the (1) that you do.
By the time you actually give "num1" and "num2" a proper value and then reach "case '^':" you do not use "num1" and "num2" with their new values you output "answer" which contains a garbage value because of garbage input.
To start with it is always a good idea to initialize your numeric variables when defined.
Lines 13 - 17 are never used. Did you have a reason for them?
Line 42 needs to look more like lines 29, 32, 35 and 39.