0

hey guys,been browsing this site for a few weeks,but this is my first post.

As you might guess by my problem I'm a C++ noob.

I'm tryin to make a program in which the user inputs an array of double, I then use bubble sort to to get it into descending order, and output it in the correct order.

the issue I'm having is that after I sort the array, only the first number comes out as a double, the rest are all integers. How can I fix it so that all the numbers come out at the end as double??

here's my code:

```
#include <iostream>
using namespace std;
int main()
{
double set[50];//sets max number of values to 50
int size, a, b, t, i;
cout << "How many values would you like to enter??\n";
cin >> size;
while (size>50)
{
cout << "That is above 50" << endl;
cout << "How many values would you like to enter??\n";
cin >> size;
}
cout << "Please enter the values:\n";
for (i=0; i<size; i++)
cin >> set[i];
for (a=1; a<size; a++)
for (b=size-1; b>=a; b--) {
if(set[b-1] < set[b]) {
t=set[b-1];
set[b-1] = set[b];
set[b] = t;
}
}
cout << "here are your values in order:\n";
for (t=0; t<size; t++)
cout << set[t] << "\n";
return 0;
}
```