Answer Posted / vili
// this deals with negative numbers as well
int getSecondMax( int* pArray, int nSize )
{
int nMax = pArray[0];
int n2ndMax = pArray[0];
for ( int i = 1; i < nSize; i++ )
{
if ( nMax < pArray[i] )
{
n2ndMax = nMax;
n2ndMax = pArray[i];
}
}
return n2ndMax;
}
| Is This Answer Correct ? | 6 Yes | 22 No |
Post New Answer View All Answers
What does #define mean in c++?
What is the difference between while and do while loop?
What do you mean by inheritance in c++? Explain its types.
What is the difference between map and hashmap in c++?
What is a .h file c++?
Is set c++?
what you know about c++?
Explain how functions are classified in C++ ?
Which one is a preferred language C or C++? Why?
What is encapsulation in c++?
what is C++ exceptional handling?
Which header file allows file i/o with streams a) fileio.h b) iostream.h c) fstream.h
What is an html tag?
what is Member Functions in Classes?
What is general form of pure virtual function? Explain?