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
What is the difference between a type-specific template friend class and a general template friend class?
What are the different types of polymorphism in c++?
What is using namespace std in cpp?
What is the difference between public, private, and protected access?
What does new in c++ do?
Is python written in c or c++?
What is ios in c++?
What is c++ manipulator?
Can c++ do everything c can?
What is flag in computer?
What is a class definition?
What is low level language in simple words?
Can user-defined object be declared as static data member of another class?
What is meant by a delegate?
Explain public, protected, private in c++?