Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Given the following seqment of code containing a group of
nested if instructions: y = 9; if ((x==3) || (x == 5)) y++;
else if (x == 2) y *= 2; else if (x == 4 ) y-= 7; else y =
8; Enter a segment of code (without any IF statements) that
does exectly the same thing using the switch structure.



Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3..

Answer / isha

y=9;
switch(x)
{
case 2:y*=2;
break;
case 3:
case 5: y++;
break;
case 4:y-=7;
break;
default:y=8;
}

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is Pure Virtual Function? Why and when it is used ?

10 Answers   Lucent, Sona,


When can I use a forward declaration?

0 Answers  


What do you mean by abstraction in C++?

1 Answers  


Explain the uses oof nested class?

0 Answers  


Explain calling an object's member function(declared virtual)from its constructor?

1 Answers  


What it is and how it might be called (2 methods).

0 Answers  


What does it mean to declare a member function as virtual?

0 Answers  


What are punctuators in c++?

0 Answers  


how to create window program in c++.please explain.

1 Answers   Microsoft,


Write about the local class and mention its use?

0 Answers  


Describe private, protected and public?

0 Answers  


Can you pass a vector to a function?

0 Answers  


Categories