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
Define a nested class.
What is the extension of c++?
What is conditions when using boolean operators?
What is set in c++?
What is the insertion operator and what does it do?
What is virtual destructor? What is its use?
How a new element can be added or pushed in a stack?
Can user-defined object be declared as static data member of another class?
Will rust take over c++?
Explain the auto storage classes in c++.
What are manipulators in c++ with example?
Explain how an exception handler is defined and invoked in a Program.
What is binary object model?
Why is c++ so fast?
What is abstraction in c++ with example?