Answer Posted / fish
int a1(int[] a)
{
int max1 = -1;
int max2 = -1;
for (int i=0; i<a.length; i++)
{
if (a[i] > max1)
{
max2 = max1;
max1 = a[i];
}
else if (a[i] != max1 && a[i] > max2)
max2 = a[i];
}
return max2;
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Which bit wise operator is suitable for turning off a particular bit in a number?
What is c++ stringstream?
what are the types of Member Functions?
Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. Your program should work for squares of all side sizes between 1 and 20. --- │ │ │ │ │ │ ---
What is the difference between mutex and binary semaphore?
What operator is used to access a struct through a pointer a) >> b) -> c) *
Is c++ faster than c?
Is C++ case sensitive a) False b) Depends on implementation c) True
Explain the difference between class and struct in c++?
Explain this pointer?
What does asterisk mean in c++?
What is pointer to array in c++?
Search for: what is pair in c++?
What is a tree in c++?
Can I run c program in turbo c++?