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 a v-table?
What is the best free c++ compiler for windows?
What is the full form of c++?
Can you pass an array to a function in c++?
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. --- │ │ │ │ │ │ ---
Can union be self referenced?
What is null and void pointer?
How do I tokenize a string in c++?
Write my own zero-argument manipulator that should work same as hex?
Give an example of run-time polymorphism/virtual functions.
What is the difference between an external iterator and an internal iterator? Describe an advantage of the external iterator.
Why is c++ still best?
What are the various oops concepts in c++?
Describe the role of the c++ in the tradeoff of safety vs. Usability?
What is a multiset c++?