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 a "Copy Constructor"?

2 Answers  


Are iterators pointers?

0 Answers  


Can we use this pointer in a class specific, operator-overloading function for new operator?

0 Answers  


Explain the different access specifiers for the class member in c++.

0 Answers  


What does obj stand for?

0 Answers  


What are the advantages of early binding?

0 Answers  


Why did you leave your last job?

2 Answers  


When volatile can be used?

3 Answers   Symphony,


what is the use of void main() in C++ language?

0 Answers  


write a program that takes 5 digit no and calculate 2 power that no and print it.

3 Answers  


How do I write a c++ program?

0 Answers  


Can you please explain the difference between overloading and overriding?

0 Answers  


Categories