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 are access specifiers in C++?

3 Answers  


Why is c++ difficult?

0 Answers  


Explain the difference between static and dynamic binding of functions?

0 Answers  


Ask to write virtual base class code?

0 Answers   Satyam,


What size is allocated to the union variable?

0 Answers  


Difference between pointer to constant vs. Pointer constant

0 Answers  


What is an operator function? Describe the function of an operator function?

0 Answers   Fidelity,


Write a program to calculate the BMI of a person using the formula BMI = weight/height2.

2 Answers  


if there is binary tree which one is the easiest way to delete all child node?

1 Answers   Persistent,


Where do I find the current c or c++ standard documents?

0 Answers  


Should I learn c++ c?

0 Answers  


In C++ cout is: a) object b) class c) something else

11 Answers   Infosys, Lehman Brothers,


Categories