Hi,

I am new to the forum. I am stuck on this assignment I have to do.

I think i have defined the array suitably enough, I just cant implement the sorting specified in the question.

Any help would be greatly appreciated.

Here is the question:

Create a program in which a user is asked for:

How many values (s)he wants to enter (maximum 50);

Asks for the values and stores them into an array of double.

Sorts the values in ascending order according to the following algorithm, where size is the number of doubles to be sorted:

for i=0..size-2

check all the values between position i and size-1 to find the smallest one

swap the smallest value and the one in position i

Prints the sorted array to the console.

```
#include <iostream>
using namespace std;
int main()
{
//Declaring Variables
int size;
double i;
//Title Screen
cout << "Welcome to Number Sorter 1.0\n" << endl;
cout << "This program sorts values in ascending order." << endl;
cout << "First you will be asked how many values you wish to enter." << endl;
cout << "Then you will be asked to enter those values." << endl;
cout << "The program will then print the sorted array.\n" << endl;
//Size Entry
do {
cout << "So, please enter the size of your array with the maximum being 50: ";
cin >> size;
} while (size > 50 || size < 0);
//Value Entry
double *arr = new double[size];
cout << "\nNow fill your array by entering " << size << " values (press enter after each value): " << endl;
for (int i=0; i < size; i++) {
cin >> arr[i];
}
cout << "\nYou entered: " << endl;
for (int i=0; i < size; i++)
cout << arr[i] << " ";
cout << endl;
delete [] arr;
return 0;
}
```