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
In what situations do you have to use initialization list rather than assignment in constructors?
Show the application of a dynamic array with the help of an example.
What is doubly linked list in c++?
Why we use #include iostream in c++?
What is the difference between a "copy constructor" and an "assignment operator" in C++?
Why do we need function?
Is c++ proprietary?
Explain the difference between class and struct in c++?
Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
There are 100 students in a class. The management keep information in two tables. Those two tables are given like Roll no Name Age 001 ABC 15 002 XYZ 14 and Roll No Subject Marks 001 Math 75 001 Physics 55 002 Math 68 001 Hindi 69 They want the information like this Roll No Name Hindi Physics Math Total 001 ABC 69 55 75 199 002 XYZ 68 74 84 226 And Roll No Suject Highest 001 Math 98 007 Physics 84 021 Hindi 74 All 275 All information is kept in structure in main memory. You have to find last two tables.
What is size_type?
Write about the access privileges in c++ and also mention about its default access level?
What are smart pointers?
What is the difference between #import and #include in c++?
What are the steps in the development cycle?