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 is size of string in c++?
What do you mean by vtable and vptr in c++?
What is a singleton c++?
Draw a flow chart and write a program for the difference between the sum of elements with odd and even numbers. Two dimensional array.
What is the meaning of c++?
What is c++ namespace?
Differentiate between a pointer and a reference with respect to c++.
What is vector string in c++?
Why should we use null or zero in a program?
What is abstract class in c++?
How are Structure passing and returning implemented by the compiler?
Can recursive program be written in C++?
What is c++ redistributable?
What are abstract data types in c++?
What do you mean by friend class & friend function in c++?