90 318
Assignments Done
99.3%
Successfully Done
In September 2020

# Answer to Question #21349 in C++ for Candice Battle

Question #21349
Input a list of positive numbers, terminated by 0, into an array Numbers [ ]. Then display the array and the largest and smallest number in it.
1
2012-12-28T05:17:37-0500

#include <iostream>
#include "conio.h"

using namespace std;

double FindMax(double aray[],int length)//Bubble sort function
{
int i;
double max;
max=aray[0];
for(i=0;i<length;i++)
{
if(max<aray[i]){
max=aray[i];
}
}
return max;
}
double FindMin(double aray[],int length)//Bubble sort function
{
int i;
double min;
min=aray[0];
for(i=0;i<length;i++)
{
if(min>aray[i]){
min=aray[i];
}
}
return min;
}
int main()
{
int n;
double array1[100];
cout<<"Enter the number of elements : ";
cin>>n;
for(int i=0;i<n;i++){
cout<<"Enter the "<<i+1<<" element : ";
cin>>array1[i];
}
cout<<"Max element is "<<FindMax(array1,n);

cout<<"
Min element is "<<FindMin(array1,n);

cout<<"
Press any key to exit....";
getch();

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!