This seems like a really simple question, but it bothers me when I don't understand why something does something, so... I need help with this.
void calculation(int a, int b) {
if (opChoice == 1) {
answer = a + b;
}
else if (opChoice == 2) {
answer = a - b;
}
else if (opChoice == 3) {
answer = a/b;
}
else if (opChoice == 4) {
answer = a*b;
}
else if (opChoice == 5) {
answer= pow(a,b);
}
}
Basically, when I have "if (opChoice == 1)" and I input '4' in the command prompt, it does multiplication- which is what it's supposed to do. But when I take out one "=" (so it would look like this >if (opChoice = 1)<), it makes it so if I enter a '4' or any other acceptable options (1-5), it ends up adding instead of Multiplying or the other operations.