0

What expression I have to insert in switch(?), that the code will run out correct?

https://code.sololearn.com/cguWbfJBhbh9/?ref=app

6th Nov 2020, 7:29 AM
TeaserCode
7 Respostas
+ 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`
6th Nov 2020, 6:03 PM
Ipang
+ 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
6th Nov 2020, 9:05 PM
David Carroll
David Carroll - avatar
+ 1
What are you trying to do?
6th Nov 2020, 9:17 AM
Ipang
+ 1
You get three lenghts of a triangle. Then you have to write a program so it put out a sort of triangle.
6th Nov 2020, 4:00 PM
TeaserCode
+ 1
Have you verified the decisive formula? I think you will need to use `if...else if...else` block rather than `switch`
6th Nov 2020, 4:03 PM
Ipang
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.
6th Nov 2020, 5:36 PM
TeaserCode
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?
6th Nov 2020, 7:40 PM
TeaserCode