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

Write the html code to bind this xml data, Question: (a) (i) Describe w...

Question: (a) (i) Describe what an XML Data Island is and outline the restrictions of using a Data Island. (ii) The following XML file book.xml is used to keep track of a l

To execute other program from already executing shell script, Normal 0 ...

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

Write a shell script to find the factorial of a given number, W.A.S.S to fi...

W.A.S.S to find the factorial of a given number. Program # W.A.S.S to find the factorial of a given number.    echo -e "enter number:\c"            #  \c Suppress trailing n

Differentiate between high level and low level languages, The languages use...

The languages used in the module are of a type known as high-level languages. There is another set of languages known as low-level languages. (a) Differentiate between high-leve

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

Class registration, using UML 1- Identify primary classes 2- Scenario d...

using UML 1- Identify primary classes 2- Scenario description 3- Class diagrams 4- Sequence diagrams

Create xml documents to contain well-defined information, The objectives of...

The objectives of this assignment are to test your ability to create XML documents to contain well-defined information. This assignment will be used further in Assignment 2, so ple

Shell script to find a particular pattern from the file, Normal 0 ...

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

Silver light uses wpf to provide included web handles, Silver light uses WP...

Silver light uses WPF to provide included web handles Microsoft Technologies Silverlight uses WPF to provide included web handles similar to Adobe Display, but with more focus on a

Explain the continue statement - computer programming, Explain the Continue...

Explain the Continue statement - Computer Programming? This is alike to break but is encountered less frequently. It merely works within loops where its effect is to force an imm

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