0
What expression I have to insert in switch(?), that the code will run out correct?
7 Answers
+ 2
Enums can come useful in making decision, but here the enum represents the decision (triangle type). The factors that affect the decision are <a>, <b> and <c>, since there are multiple factors to consider, `if..else if...else` block is more suitable to making decision opposed to `switch`
+ 2
TeaserCode Take a look at my refactored version of your code.
I think you'll learn quite a bit of you compare the code and the approach.
Hopefully, this will make sense.
https://code.sololearn.com/cP9IAB6QZ5nm/?ref=app
+ 1
What are you trying to do?
+ 1
You get three lenghts of a triangle. Then you have to write a program so it put out a sort of triangle.
+ 1
Have you verified the decisive formula?
I think you will need to use `if...else if...else` block rather than `switch`
0
If you have enum then it is the most appropriate way using switch. You can do it with if-else too. But I want to try with switch approach. I don't know what statement to use in switch. You must use parameters (a, b, c) in some way.
0
Yes, I understand what you mean. But do you think it is possible to use condition statements between multi-choices in switch. I don't know how to involve three parameters in switch expression?