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

Calculating percentage differences-circuit diagram, In the procedure sectio...

In the procedure section, it is important to have a clear circuit diagram with component values and a brief, but accurate description of each step taken. 1. Tables for both the

Discuss on unix kernel components, Question 1 Discuss on UNIX kernel co...

Question 1 Discuss on UNIX kernel components 2 Explain process creation and process termination 3 When do a Deadlock occur? What are the Necessary Conditions for Deadlock

Programming, You must programme an analogue clock and digital stopwatch usi...

You must programme an analogue clock and digital stopwatch using the Processing programming language

.net class library, .NET class library .NET structure comes with just on...

.NET class library .NET structure comes with just one category selection. And that all developers need to learn!! Whether they create the value in C# or VB.NET or J#, it doesn't

Javascript variables and datatypes, Let us first see the skeleton of a Java...

Let us first see the skeleton of a JavaScript file. JavaScript code should be written between the and tags. The value LANGUAGE = "JavaScript" indicates to the browser that J

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

Write simple scripts programs , Write 3 somewhat simple scripts / programs ...

Write 3 somewhat simple scripts / programs in any language, combination of languages, and/or software. Please tell me the task you are trying to accomplish in the scripts. Idea

Define functions with no arguments and no return values, Define Functions w...

Define Functions with no arguments and no return values? When a function has no arguments it doesn't receive any data from the calling function. Likewise, it doesn't return any

Rewrite the xhtml code, Below is an example of an invalid XHTML page. Your ...

Below is an example of an invalid XHTML page. Your goal is to rewrite the code so that: No deprecated/obsolete tags are being used All elements are nested correctly (i.e

HTML Form/JavaScript, I have a problem which seems to be quite a rare one a...

I have a problem which seems to be quite a rare one and I can safely say I know what exactly what is causing it. After some process of elimination I reached the conclusion that, in

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