# Help cant figure this out

#### PrincoPrince

Joined Feb 12, 2015
10
Write a c++ program to accept ten integer values in an array in descending order.
NB: The input of the elements is via keyboard.

#### ErnieM

Joined Apr 24, 2011
8,221
Howdy. This looks like a homework assignment, so what have you done to solve this?

#### WBahn

Joined Mar 31, 2012
26,398
Do you know how to accept a single integer value from the keyboard and put it into a variable of type int?

Do you know how to loop through an array of ten integers?

If so, try your best to combine these two and show your best shot at it.

#### spinnaker

Joined Oct 29, 2009
7,835

And your problem does not make any sense. Unless the human is going to input in descending order.

#### Cardinal Steel Lungs

Joined Oct 14, 2014
1
I'm assuming (yes I know the name of the game is assume nothing, but I'm a renegade Cardinal) that he wants to print the integers in descending order, and he forgot to elucidate that point.

So you need to accept user input into an array of type int, iterate through the array and implement the logic required to print in descending order... or something. Maybe.

#### PrincoPrince

Joined Feb 12, 2015
10
Howdy. This looks like a homework assignment, so what have you done to solve this?

#### Attachments

• 184 bytes Views: 18

#### PrincoPrince

Joined Feb 12, 2015
10
Do you know how to accept a single integer value from the keyboard and put it into a variable of type int?

Do you know how to loop through an array of ten integers?

If so, try your best to combine these two and show your best shot at it.

#### Attachments

• 184 bytes Views: 10

#### PrincoPrince

Joined Feb 12, 2015
10

And your problem does not make any sense. Unless the human is going to input in descending order.

#### Attachments

• 184 bytes Views: 12

#### DumboFixer

Joined Feb 10, 2009
217
Write a c++ program to accept ten integer values in an array in descending order.
NB: The input of the elements is via keyboard.
Ok, I've done that - now what do I do ?

#### ErnieM

Joined Apr 24, 2011
8,221
That is at least a start, good. It should compile as the for loop only has a single statement; generally you will have more than one statement so you would need { } brackets to enclose the loop. So what you did was fine it is preferable to add those brackets even if not completely necessary. That's just good practice (meaning it reduces errors).

So you have a loop to accept the 10 integers, so far so good. Now you need to sort the numbers. Have you researched how to sort things? You have your class book, notes, and Google to help you there. You may want to try looking up "bubble sort."

Some standard C/C++ libraries already have sort routines, but I would not advice using them for now. It is better if you learn how to write a simple routine like this as a learing tool.

#### PrincoPrince

Joined Feb 12, 2015
10
Howdy. This looks like a homework assignment, so what have you done to solve this?

#### PrincoPrince

Joined Feb 12, 2015
10
Please how do I sort the code.

#### djsfantasi

Joined Apr 11, 2010
8,086