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

Find the second maximum in an array?

Answer Posted / foreverkushal

int SecondMax(int *Array, int ACount)
{
int Fm = 0, Sm = 0;
for (int i = 0; i < ACount; i++)
{
if (Array[i] > Sm)
{
if (Array[i] < Fm) Sm = Array[i];
else
{
Sm = Fm;
Fm = Array[i];
}
}
}
return Sm;
}

Is This Answer Correct ?    31 Yes 22 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an operator in c++?

1074


What is c++ stringstream?

1114


Explain the static storage classes in c++.

1285


What is the disadvantage of using a macro?

1137


What do you mean by storage classes?

1616


What is a set in c++?

989


What does h mean in maths?

1233


What is heap sort in c++?

1083


What does scope resolution operator do?

1125


Should you pass exceptions by value or by reference?

1141


In a function declaration what does extern means?

1068


What do the keywords volatile and mean mutable?

1064


What is the difference between object-oriented programming and procedural programming?

1241


Explain the purpose of the keyword volatile.

1175


How do I run c++?

1083