*Try the program then answer the questions below * PROGRAM: #include using namespace std; int main () { int arr[10], num, x, y, z, highest, lowest; cout > num; cout > arr[x]; highest = arr[0]; for (x...



*Try the program then answer the questions below
*




PROGRAM:


#include
using namespace std;


int main ()
{
int arr[10], num, x, y, z, highest, lowest;


cout < "\nenter="" the="" number="" of="" items="" to="" sort:="">
cin >> num;
cout < "enter="" the="" numbers:="">




for (x = 0; x < num;="">
cin >> arr[x];


highest = arr[0];


for (x = 0; x < num;="">
{
if (highest <>
highest = arr[x];
}


lowest = arr[0];


for (x = 0; x < num;="">
{
if (lowest > arr[x])
lowest = arr[x];
}


for(x=0; x
{

for(y=x+1; y
{
if(arr[x]>arr[y])
{
z =arr[x];
arr[x]=arr[y];
arr[y]= z;
}
}
}


cout < "\n="">

cout < "="">

cout<"\nlowest -=""> Highest:"<>
for(x=0; x
cout <><><">
cout<>





for(x=0;x<>
{

for(y=x+1;y<>
{
if(arr[x]<>
{
z = arr[x];
arr[x]=arr[y];
arr[y]= z;
}
}
}




cout<"\n\nhighest -=""> Lowest:"<>


for(x=0; x
cout <><><">
cout<>



cout < "\n="">

cout < "="">

cout < "\nhighest="" number="" :="" "="">< highest=""><>
cout < "lowest="" number="" :="" "="">< lowest=""><>




return 0;


}




QUESTIONS:


1.) Can this program be done with only 1 integer array being used? Explain your answer.


2.) Explain how the program was able to determine the highest and lowest element.


Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here