Answer Posted / vinod, bangalore, india
int Second_Max(int* numbers, int Lenght)
{
int Max, Sec_Max, index;
Max = Sec_Max = numbers[0];
for(index=0; (index<Lenght) &&(Max == Sec_Max);
index++)
{
if(Max > numbers[index])
Sec_Max = numbers[index];
else
Max = numbers[index];
}
if(index == Lenght)
{
printf("Array contain simillar data and the
data is = %d \n", Max);
return false;
}
for(index =0; index < Lenght; index++)
{
if(numbers[index] > Max)
{
Sec_Max = Max;
Max = numbers[index];
}
if((numbers[index] < Max) && (numbers
[index] > Sec_Max))
{
Sec_Max = numbers[index];
}
}
return Sec_Max;
}
| Is This Answer Correct ? | 2 Yes | 7 No |
Post New Answer View All Answers
Who was the creator of c++?
How can you quickly find the number of elements stored in a static array? Why is it difficult to store linked list in an array?
Does std endl flush?
Explain the different access specifiers for the class member in c++.
What is operators in c++?
What is the maximum combined length of command line arguments including the space between adjacent arguments?
total amount of milk produced each morning and then calculates and outputs the number of cartons needed for this milk , the cost of producing the milk and the profit from producing this milk.
Can we use clrscr in c++?
What is array give example?
What is the difference between a reference and a pointer?
What is stl containers in c++?
What are the advantages of using pointers in a program?
What are the benefits of operator overloading?
Explain the differences between private, public and protected and give examples.
Can we make any program in c++ without using any header file and what is the shortest program in c++.