*Try to run the program then answer the following questions below* Here is the program: #include using namespace std; int main () { int arr[10], num, x, y, z, highest, lowest; cout > num; cout >...



*Try to run the program then answer the following questions below*



Here is the 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.) What is the algorithm used to sort elements of array in ascending and descending order?


2.) How many integer arrays were used in this program?

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here