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
What is anonymous object in c++?
What is the use of 'using' declaration in c++?
how can i access a direct (absolute, not the offset) memory
address?
here is what i tried:
wrote a program that ask's for an address from the user,
creates a FAR pointer to that adress and shows it. then the
user can increment/decrement the value in that address by
pressing p(inc+) and m(dec-).
NOW, i compiled that program and opened it twice (in 2
different windows) and gave twice the same address to it.
now look what happen - if i change the value in
one "window" of the program, it DOES NOT change in the
other! even if they point to the same address in the memory!
here is the code snippet:
//------------------------------------------------------
#include Do we have to use initialization list in spite of the assignment in constructors? what are the iterator and generic algorithms. What is tellg () in c++? Describe the advantage of an external iterator. Am pass the 10000 records to target in target I will take commit interval 15000 when I was stop the work flow what will happened How many keywords are used in c++? What is the output of the following program? Why? What is private inheritance? What is abstraction in c++ with example? What is the difference between interpreters and compilers? What are the classes in c++? What kind of problems can be solved by a namespace?