Answer Posted / jaldeep
int sec_max(int a[])
{
if(a[0]>a[1])
{
max=a[0]
sec_max=a[1]
}
else
{
max=a[1]
sec_max=a[0]
}
for(i=1;i<n-1;i++)
{
if (a[i]>sec_max && a[i]< max)
{
sec_max=a[i];
}
else if(a[i]>max)
{
sec_max=max;
max=a[i];
}
return sec_max;
}
Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
How do you establish an is-a relationship?
What is constructor and destructor in c++?
When does a 'this' pointer get created?
Explain function overloading
What is rtti in c++?
Why do we use double in c++?
If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?
which of the following is not an secondary constant a) array b) real c) union
Explain how an exception handler is defined and invoked in a Program.
Is std :: string immutable?
What is the arrow operator in c++?
What are mutator methods in c++?
Can I learn c++ without knowing c?
How new/delete differs from malloc()/free?
What is c++ programming language?