#Need help with case outputs

13 messages · Page 1 of 1 (latest)

ornate rover
#

doing hw right now and i dont understand why the multiplication is not worming + why my double is not recognized in the switch command.
and after that how do i print the results for each case?

jolly pewterBOT
#

This post has been reserved for your question.

Hey @ornate rover! Please use /close or the Close Post button 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.

rocky locust
#
  1. you can only switch on ints or longs, or other special types like enums
  2. your betrag variable isn't initialized, it does not have a value when that switch happens
  3. you dont use the resulting value of the calculation, so the calculations are pointless
ornate rover
#

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

ornate rover
dull perch
#

Then use if statements instead of a switch

blazing terrace
#

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

ornate rover
#

:/

#

yea then whatever im just asking the teacher what to do