about sorting algorithm..

hi, i'm a newbie in programing and i just would like to ask.. cuz someone give me a problem..
he asks me to build a program that uses a single-dimension array that to store 10 numbers inpu by a user. After inputting the numbers; the user should see a menu with two options to sort (using a sorting algorithm) and print the 10 numbers in ascending order.
You forgot to ask your question.
that's why i'm asking cuz i don't have any idea how to do this..XD lol
i'm just a newbie sorry...
Define the array as int numbers[10];.
First make the part to input the numbers, then we'll sort it.
and there are multiple different ways of doing a sorting algorithm, but i think the most common one to start with is a sequential search, if i'm not mistaken. so you populate an array, with values. Then once you've done that you want to check each one to see if something is true, or if it exists. so you would use a for loop to go through each one of the values, and inside that for loop you would check to see if it exists, if it doesn't exist then you continue searching for it.

This might help:
http://mathbits.com/mathbits/compsci/Arrays/Search.htm

Hope this helps a little.
tnxXD
any day, that's what these forums are for :D. I found them not too long ago, and have started becoming way more active on them. Hopefully we will see you on the forums asking questions and trying to learn new things. Everyone is kind here, and willing to help you learn.
Topic archived. No new replies allowed.