*Try to run the program then answer the following questions below*
Here is the program:
#includeusing 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; xcout <><><">">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; xcout <><><">">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?"\n\nhighest>"\nlowest>
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; xcout <><><">">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; xcout <><><">">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?
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here