I'm trying to sort an array least to greatest and i am really lost....
Here is what i have so far:
int temp, temp2;
for (int x = 0; x < array_size; x++)
{
temp=a[x];
for (int i = 0; i < array_size; i++)
{
if (a[i] < temp)
{
temp2=a[i];
a[i]=temp;
a[x]=temp2;
}
}
}
updated: still not working and i have to use code.
int temp, temp2, x=-1;
for (int x = 0; x < array_size; x++)
{
temp=a[x];
for (int i = x+1; i < array_size; i++)
{
if (a[i] < temp)
{
temp2=a[i];
a[i]=temp;
a[x]=temp2;
}
}
}