# I'm loooost

This is a discussion on I'm loooost within the C++ Programming forums, part of the General Programming Boards category; Uhh yes I got no clue where to begin. The assignment is to ask for an input up to 32,767 ...

1. ## I'm loooost

Uhh yes I got no clue where to begin. The assignment is to ask for an input up to 32,767 (short int, I know how to do this), then take that number and display it like this, with three spaces between.

Input: 1234

Output:
0 1 2 3 4
1 2 3 4
2 3 4
3 4
4

I got no clue. I've asked questions in class on how to go about it, professor said divide by 10,000 and use a mod on what was leftover or something of the like, but I don't understand how to rip the number apart, assign zero's to places which don't have a number, and then space it out by three.

*Edit*

I have to do this without loops btw.

*Editx2 LOL*

I sort of figured out that I have to use % to get the numbers but I still don't get how to "rip" them up into the format she wants.

2. 1234 / 1000 = 1
1234 %= 1000

number is now 234

234 / 100 = 2
234 %= 100

number is now 34

34 / 10 = 3
34 %= 10

number is now 4

and youre done

Popular pages Recent additions