#Need help with case outputs
13 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @ornate rover! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
- you can only switch on ints or longs, or other special types like enums
- your betrag variable isn't initialized, it does not have a value when that switch happens
- you dont use the resulting value of the calculation, so the calculations are pointless
and how do i fix that? first i change the double to a long/int. and then?
ok i fixed most of this
but how do i fix that:
switch(betrag)
that betrag variable does not work
yea the problem is. the only way of fixing number 1 is to change my double to a int. but i cant calculate the other stuff with it because it NEEDS to be double (homework thing)
Then use if statements instead of a switch
It's still weird to use a double when you're interested in a dichotomy of values that may be reached. But sometimes homework will be weird, that happens