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 polymorphism and its type in c++?

1116


How would you use the functions memcpy(), memset(), memmove()?

1142


Does c++ have arraylist?

1077


What are the comments in c++?

1036


I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.

2867


what is data encapsulation in C++?

1121


What is runtime polymorphism in c++?

1226


What is pointer -to-members in C++? Give their syntax?

1075


Why cout is used in c++?

1075


Can we use clrscr in c++?

1127


Why use of template is better than a base class?

1249


Which is not a valid keyword a) public b) protected c) guarded

1303


what are the characteristics of Class Members in C++?

1089


What does it mean to declare a member function as static?

1106


Why is that unsafe to deal locate the memory using free( ) if it has been allocated using new?

1121