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

Write a program that read 2o numbers in and array and
output the second largest number. Can anybody help??

Answer Posted / mms zubeir

void main()
{
int numbers[20];
int biggest=0, secondBiggest=0;

for(int index = 0; index < 20; ++index)
{
int input;
cin>>input;

if(input == biggest)
continue;

if(input > biggest)
{
secondBiggest = biggest;
biggest = input;
}
else if(input > secondBiggest)
secondBiggest = input;
}

cout<<endl<<"Biggest : "<<biggest<<endl<<"Second
biggest : "<<secondBiggest<<endl;

getch();
}

Is This Answer Correct ?    6 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you quickly find the number of elements stored in a static array?

1109


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

1122


Which operations are permitted on pointers?

1007


Explain the concept of friend function in c++?

1129


What are default parameters? How are they evaluated in c++ function?

1186


Difference between overloaded functions and overridden functions

1076


What is difference between malloc()/free() and new/delete?

1181


What are manipulators used for?

1107


Is it possible to get the source code back from binary file?

1385


What is an inline function in c++?

1135


Does std endl flush?

1052


How can a called function determine the number of arguments that have been passed to it?

1156


Explain how the virtual base class is different from the conventional base classes of the opps.

1181


What is #include iomanip?

1019


What is an adaptor class or wrapper class in c++?

1257