Explore BrainMass

Differences between IF/ELSE and SWITCH statements

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

Can you please help with the following study question. Thanks

What are major differences between if/else selection structure and switch selection structure? What do you need to analyze when directing the flow of information in each case? Give code examples for if/else structure and switch structure which produce the same result.

© BrainMass Inc. brainmass.com October 24, 2018, 10:16 pm ad1c9bdddf

Solution Summary

This solution describes the differences between if-else and switch selection statements. It also gives an example to illustrate this difference.

See Also This Related BrainMass Solution

Mfile program

1) OK, please just create mfile basic programs to say calcluate the sum of any series for example using a while loop, a for loop, and if statement, if else, switch statement.

Also, prompt the user to enter a value or values, use relational operators, logicals like and,or,not if possible.

I just want to learn and see done programs with all these things. If their is a way to keep them mostly the same so I may compare to see differences this is good., it may reduce amount of help I ask of you. Also, if can also use the max and index functions to find the numbered element that would help too

2) A mfile program using a while loop until a condition is met and a program to approximate for 400 terms using a for loop. Finally, on the loops, please place some comments on what is going on if ok


View Full Posting Details