Write your question here.
Hey everyone,
I am writing a program that takes an input for students id (and several other things) and it has to compare all of them and display in least to greatest order. I don't how I can use my code to make it work. Please help.
In very easy to understand way,
You just loop and print the least one out, then mark it that you printed so not use to compare next time. Maybe another array or change it to -1;
i.e., use -1,
ID 5 3 4 7 6 -> loop find least and not -1 (3)
print 3, ID = 5 -1 4 7 6 -> loop find least and not -1 (4)
print 4, ID = 5 -1 -1 7 6 -> etc.
This is technique like Selection Sort.
And if you want to order them in array before print. Use keyword Sort Algorithm and learn, very smart to go.