FIND THE ANSWERS

How to make a program that will arrange 10 inputed arrays numbers in ascending order?

Answer this question

  • How to make a program that will arrange 10 inputed arrays numbers in ascending order?


Answers

Answer #1 | 20/12 2013 05:39
Lucky you. I'm learning about C++ using the nano text editor. IDEs are for wimps. XD Anyway, there are two ways to swap array elements. You can swap individual elements using a swap function, or arrange them using a sort procedure. The easiest way is to use a sort function (I find it the easiest to understand). You can use a void function, like so: void sort ( int array[], int SIZE ); Since you have 10 numbers, the constant SIZE = 10. You can then use a for loop to arrange the element values in ascending order. An example for loop would be: for ( int index = 0; index < SIZE; index++ ) { .... You can find more info here: http://www.cplusplus.com/reference/algorithm/sort/?kw=sort Hopefully you know what goes in the for loop. I don't wanna do your homework for you. ;)

Possible answer