#include <iostream> using namespace std; const int MAX =5; //These functions exp
ID: 3619052 • Letter: #
Question
#include <iostream>
using namespace std;
const int MAX =5;
//These functions explained below
void spaces();
void introduction();
void input(intnumbers[]);
void number(intnumbers[], int size);
int main()
{
int numbers[MAX];
char response;
do
{
input(numbers);
number(numbers, MAX);
//Asks the user he would like to go again anything other than (Y ory) the program ends
cout << "Would you like to go again (Yor y): ";
cin >> response;
cout << endl;
}while(response == 'Y' || response== 'y');
return 0;
}
//This void function is for 2 statement spaces betweensentences
void spaces()
{
cout << endl << endl;
}
//This void function explains what the program is about toperform
void introduction()
{
cout << " ";
spaces();
}
void input(intnumbers[])
{
for(intindex = 0; index < MAX; index++)
{
cout << "Number Please:";
cin >> numbers[index];
}
}
void number(intnumbers[], int size)
{
int temp[MAX];
int lowest, low;
for(inti = 0; i < size; i++)
temp[i] = numbers[i];
for(intindex = 0; index < size; index++)
{
low = numbers[index];
for(inti = 1; i < size; i++)
{
if(numbers[i] < low)
{
lowest = numbers[i];
numbers[i] = low;
numbers[index] = lowest;
//temp[index] = numbers[index];
}
}
//numbers[index] = lowest;
}
for(inti = 0; i < size; i++)
cout << numbers[i];
}
Explanation / Answer
please rate - thanks hope this helps. don't peek at the message get rid of temp as an array, make it a single variable your sort is 2 nested loops assuming 5 numbers the 1st goes from index 0, and goes until 3 (Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.