First of all, since your weather
variable is an
, when it asks you for the weather, you have to enter an integer.
If that's not what you want,
Now, your problem is that in golf::calculate()
, you declare three
, and overcast
) that, since they are all uninitialized, all contain some random garbage values.
Then you try to compare your weather
variable with those values.
Unless the user is really
good at guessing what values to enter for it to be sunny, raining, or overcast, it's never going to be any of them.
So, if you change weather
to a string
like I suggested, you just have to do
if (weather == "sunny")
else if (weather == "overcast")
// and so on
and you don't need those other variables at the beginning.