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...

Identify the errors in the following program.
#include <iostream>
using namespace std;
void main()
{
int i=5;
while(i)
{
switch(i)
{
default:
case 4:
case 5:
break;
case 1:
continue;
case 2:
case 3:
break;
}
i-;
}
}

Answer Posted / hr

case 1 :
continue;
The above code will cause the following situation:
Program will be continuing while value of i is 1 and value of i is updating. So infinite loop will be created.
Correction: At last line i- should be changed as i–;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are static member functions?

1121


What does asterisk mean in c++?

1119


What is null and void pointer?

1063


What are vtable and vptr?

1149


What are namespaces in c++?

1099


Will c++ be replaced?

1046


What is a rooted hierarchy?

1166


Explain what are accessor methods?

1125


What is a constant? Explain with an example.

1019


What is the best c++ book?

1268


What is the best c++ compiler for windows 10?

1041


What are the advantage of using register variables?

1174


What new()is different from malloc()?

1111


Can destructor be overloaded?

1035


Show the declaration for a pointer to function returning long and taking an integer parameter.

1144