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
Should you pass exceptions by value or by reference?
What is #include sstream?
Why c++ does not have finally?
Explain terminate() and unexpected() function?
What is the difference between a pointer and a link in c ++?
How do you generate a random number in c++?
Eplain extern keyword?
How would you use the functions memcpy(), memset(), memmove()?
What is the word you will use when defining a function in base class to allow this function to be a polimorphic function?
What is c++ runtime?
Does c++ have foreach?
Is it legal in c++ to overload operator++ so that it decrements a value in your class?
Are vectors passed by reference c++?
What are activex and ole?
why is iostream::eof inside a loop condition considered wrong?