Answer Posted / rw-rwx
This might help.
max1=a[0];max2=a[1];
for(i=1;i<n;i++)
{
if(max1<a[i])
{
max2=max1;
max1=a[i];
}
if(max2==max1) max2=a[i+1];
if(max2==a[n]) { printf("All numbers are the same no second max.\n"); return 0;}
if(max2<a[i] && max1!=a[i]) max2=a[i];
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is size of string in c++?
If you hear the cpu fan is running and the monitor power is still on, but you did not see anything show up in the monitor screen. What would you do to find out what is going wrong?
How can we check whether the contents of two structure variables are same or not?
Write some differences between an external iterator and an internal iterator?
Explain what is class definition in c++ ?
what are Access specifiers in C++ class? What are the types?
Explain linear search.
Explain the use of vtable.
What are function prototypes?
What is the difference between mutex and binary semaphore?
What is the use of cmath in c++?
the maximum length of a character constant can be a) 2 b) 1 c) 8
What is function overloading in C++?
Does c++ have string data type?
Can we use this pointer inside static member function?