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

Linux Lab Assignments, I have a linux lab class that consist of 1 lab assig...

I have a linux lab class that consist of 1 lab assignment per week for 5 weeks. It is an online virtual lab and is fairly easy, I just don''t have the time.

We need help for build a price quote generator, We need help for build a Pr...

We need help for build a Price Quote Generator I am interested in two things (A) a web based system that will allow a user to enter the parameters of their contests (there are o

Pros and cons of Assembly language, What are the main pros and cons of asse...

What are the main pros and cons of assembly programming language?

What are the Functions in Computer Programming, What are the Functions in C...

What are the Functions in Computer Programming? A program is completed up of one or more functions, with one of these being main(). Function is a self-contained block of progra

Write out the syntax of nested if statements, Write out the Syntax of Neste...

Write out the Syntax of Nested if Statements? The universal form is                         If(expression 1)                         {

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

Matlab, i have a=[0 1 1 2 2 3 6 7 0 4 ] i want to delent elemet but keep it...

i have a=[0 1 1 2 2 3 6 7 0 4 ] i want to delent elemet but keep its position i.e a(4)=[] it gives me 0 1 1 2 3 6 7 0 4 but i need 0 1 1 [] 2 3 6 7 0 4

Java source code classes and objects, Design and implement a stringed music...

Design and implement a stringed musical instrument class using the following guidelines: a. Data fields for your instrument should include number of strings, an array of stri

Explain the applet element, Explain the applet Element ? Applets are em...

Explain the applet Element ? Applets are embedded in web pages by using the and tags. The APPLET element is same to the IMG element. Like IMG APPLET references a source fil

Artificial intelligence, Describe briefly how you might program a computer ...

Describe briefly how you might program a computer to exhibit fear or sorrow.

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