Monday, March 7, 2011

Post 4

Done with if...else statement ? Lets switch to the new statement of selection that are switch statement. Switch statement is very useful to replace nested if statement. For example, if we want to make a program to determine the performance of the student based on their current class.

Click here for coding.

This program will display whether the students is a genius, good, average or poor students based on their current class. The default statement is like else statement. It will be executed if the user didn't enter A, B, C or D class.

No comments:

Post a Comment