0

I'm trying to write a program to read lists of number from a txt file then bubble sort it in increace order and find the average of every single list.

That's what i got so far

```
#include <iostream>
#include <fstream>
#include <stdio.h>
using namespace std;
void bubbleSort(int *array,int length)
{
int i,j,temp;
for (i=(length-1);i>= 0;i--)
{
for (j=1;j<=i;j++)
{
if (array[j-1]>array[j])
{
temp=array[j-1];
array[j-1]=array[j];
array[j]=temp;
}
}
}
}
int main()
{
int sum=0,temp=0, many=0;
double average=0.0;
ifstream myfile("data.txt");
if(myfile.is_open())
{
myfile>>many;
for(int i=0;i<many;i++)
{
myfile>>temp;
sum+=temp;
}
average=((double) sum)/many;
cout<<"There were "<<many<<" numbers.\n";
cout<<"Their average was "<<average<<endl;
}
}
```

I don't know if i'm doin' it right!