Create a code using a function to sort 10 double values. Allow the user to input the values.
#include <iostream>
#include <vector>
using namespace std;
void sort(vector<double>& a)
{
for (int i = 0; i < a.size(); i++)
{
for (int j = i + 1; j < a.size(); j++)
{
if (a[i] > a[j])
{
double k = a[i];
a[i] = a[j];
a[j] = k;
}
}
}
}
int main()
{
vector<double> a(10);
for (int i = 0; i < 10; i++)
{
cin >> a[i];
}
sort(a);
for (int i = 0; i < 10; i++)
cout << a[i] << " ";
}