if (checkForRoll == "intellect" && checkForRoll == "Intellect") {//checks for intellect
intellect = intellect + 5;
} else if (checkForRoll == "strength" && checkForRoll == "Strength") {
strength = strength + 5;
}
cout << intellect;
When I execute this, the intellect int does not add by 5. Why?
You are requiring your string to equal both intellect and Intellect which is impossible. Change the "and" (&&
) to an "or" (||
).
Your variable checkForRoll can't be 'strength' && 'Strength', it can be 'strength' || 'Strength' however.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With