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 the use of vtable?
Which is better c++ or java?
Write about the use of the virtual destructor?
What are the various storage classes in C++?
What are friend classes? What are advantages of using friend classes?
Explain what you mean by a pointer.
How do you invoke a base member function from a derived class in which you’ve overridden that function?
What is string in c++ programming?
Should the this pointer can be used in the constructor?
Is c better than c++?
Show the declaration for a static member variable.
Do you know what are the new features that iso/ansi c++ has added to original c++ specifications?
What is flush programming?
What is the disadvantage of using a macro?
What is the basic of c++?