i want to use a bubble sort to a external data file while looks like this.
00000002
45
56
32
46
00000001
87
95
83
100
so all the data that is under 00000001 appear before 00000002. i'm guessing in order to do so, i need to use a 3d array. is there is a way a way to store all the data under 00000001 under a variable and just use a simple bubble sort method to sort it. if this can be done, then i could use something like this to sort.
void displayArray(int sArray[2])
{
int i = 0;
while(i<2)
{
cout << sArray[i];
cout << "\n";
i++;
}
}
void sortArray(int sArray[2])
{
int temp = 0;
bool sorted = false;
while(sorted == false)
{
sorted = true;
for(int i=0; i<1;i++)
{
if(sArray[i]>sArray[i+1])
{
temp = sArray[i];
sArray[i] = sArray[i+1];
sArray[i+1] = temp;
sorted = false;
}
}
}
}