+ 1

Is switch only able for integrer??

I am trying to use a switch with doubles but it requieres an int, is there a way in which I can use it writing doubles?

9th Apr 2018, 6:39 PM
silvia mena
silvia mena - avatar
4 Respuestas
+ 3
You could always round it out or even multiply it by 100 to get an integer form of your value to use in the switch. However, what are you trying to accomplish? May be a better way overall
9th Apr 2018, 6:49 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 3
You're welcome! What type of math problems are you trying to solve via this program? If you give me more information, I may be able to type up some functions that'll work out better than using a "switch hack" to solve the issue.
10th Apr 2018, 2:02 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 1
That's a very smart idea, to multiply it, operare and then divide again, thanks, I was trying a program that could solve some mathematical problems from school, Thanks so much:)
9th Apr 2018, 6:54 PM
silvia mena
silvia mena - avatar
+ 1
Some basic trigonometry problems, in which you enter an angle and a side and it solve the rest of solutions. I am using the switch bc I am not able to find a way of using loops🤔
10th Apr 2018, 2:30 PM
silvia mena
silvia mena - avatar