views:

86

answers:

2

Hi,

I'm trying to use C++ to grab 5 digits from the user and repeat it back to the user. Unfortunately, the closest I have come to that is by repeating it back backwards...

any help here?

+1  A: 

As you get the digits, put them in a queue. Once you are done getting the digits, just go through the queue to repeat the digits back. The queue will ensure FIFO ordering. See std::queue. http://www.cplusplus.com/reference/stl/queue/push/

anio
to complicated solution for a simple H/W question
Drakosha
@Drakosha Probably because homework questions should not contain mere **solutions**.
Tomasz Łazarowicz
right, they should contain textual *solutions*, not trying to confuse the asker
Drakosha
A: 

Just store each digit in an array

int digits[5];

Then loop through the array, printing each digit

robev