squeek wrote:
> i am in a C++ programing class in college (i hate computers because i
> learn with my hands and can't tear a computer apart to see how it
> works) and i don't know what i am doing with this class i hate it we
> are currently working with arrays, and i need help writing a program
> that sorts intigers from smallest to to the biggest. thanks in advance
Lets leave the hatred aside for a moment and try on our own to solve
the problem at hand.
Say if I give you 5 different integers viz 23, 11, 2, 56, 5 how would
you go about arranging them in ascending (smallest to bigger) order ?
You would first start off with 23 and compare it others and bring 11
forward in place of 23 and then 2 forward and so on...So after the 1st
round, you would have :
11, 2, 5, 56, 25....
Next start off with 11 and continue...
So continue your rounds and after sometime you may have the array in
correct order.
Note : This is not one of the more efficient techniques for sorting
though. Once you get an idea, someone would try and tell you why it is
not efficient and which is a better option. But then someone might
stand up and say why not start with the most efficient technique
rightaway ? Good question, I dont remember that technique.