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

How do you compile the source code with your compiler?

1050


what is C++ exceptional handling?

1170


What is the difference between an array and a list?

1026


What is a buffer c++?

1058


In inline " expression passed as argument are evalauated once " while in macro "in some cases expression passed as argument are evaluated more than once " --> i am not getting it plz help to make me understand....

2417


Can we overload operator in c++?

1032


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

1352


Should I learn c or c++ first?

1123


What is c++ and its features?

1011


What is a storage class? Mention the storage classes in c++.

1022


Explain the difference between new() and malloc() in c++?

1129


How does the copy constructor differ from the assignment operator (=)?

1137


What is class invariant in c++?

1225


Explain about templates of C++.

1147


What is the disadvantage of using a macro?

1116