Define an example of switch statement, Programming Languages

Assignment Help:

Define an Example of Switch Statement?

estimate(number)

int number;

/* Estimate a number as none, one, two, several, many */

{      

switch(number)

{

case 0 : {

printf("None\n");

break;

}

case 1 : {

printf("One\n");

break;

 }

case 2 : {

printf("Two\n");

break;

}

case 3 :

case 4 :

case 5 : {

printf("Several\n");

break;

}

default : {

printf("Many\n");

break;

}

}

}

Every interesting case is listed with a corresponding action and the break statement prevents any further statements from being executed by leaving the switch. Ever since case 3 and case 4 have no following break they continue on allowing the same action for several values of number.


Related Discussions:- Define an example of switch statement

Develop a diagram to model functionality, Develop (i) a context diagram, an...

Develop (i) a context diagram, and (ii) a use case diagram to model the following functionalities of an online brokerage house. eBroker is a discount online broker. An account h

Depth estimation from a single view camera, i doing a project about depth e...

i doing a project about depth estimation, i have done some research, and i used the block matching algorithm to get the motion vectors from the image sequences, i now have the prob

FORTRAN, WRITE A FORTRAN PROGRAMME TO GENERATE PRIME NUMBERS BETWEEN 1 AND ...

WRITE A FORTRAN PROGRAMME TO GENERATE PRIME NUMBERS BETWEEN 1 AND 100.

Jsp project, Eclipse Jsp Project. I am making a a project on my website and...

Eclipse Jsp Project. I am making a a project on my website and i was making a help support page on which the user can submit their question and the question is saved to a text file

Apply generic algorithms in solving programming problems, Educational Objec...

Educational Objectives: After completing this assignment, the student should be able to accomplish the following: Apply generic algorithms in solving programming problems Define an

Online Business Systems, Task .Task 1 Database design This task will allow...

Task .Task 1 Database design This task will allow you to demonstrate the following Learning Outcomes (LOs): LO 2. Justify the design and development of the application and critica

Develop an application for airraid game, Extend the AirRaid game, so that t...

Extend the AirRaid game, so that the planes drop a bomb on the gun as they go over it. The gun has to move out of the way otherwise it will be destroyed if hit. Provide three lives

Shell script convert the given amount into words, Normal 0 fals...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Visual basic a simple help, hello there, I making a program for the collage...

hello there, I making a program for the collage but I got stuck at one point, I have a timmer that moves object pnl with the pnl.left function, but I want it when it gets to end of

Computes the least squares fit of the data, Your solution to the problem sh...

Your solution to the problem should be housed within a while loop, which allows the grader to test your solution repeatedly without having to re-execute the script, as shown in cla

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd