Need help! I want to output on multiple lines!

Apr 12, 2014 at 10:41am
I want to write a program to ask for user input like this:

Input : ABCDE
row: for example, 3
column = row

then the output will be like:

ABC
DEA
BCD

if the user wants 4x4, then the output will be like:

ABCD
EABC
DEAB
CDAB

I can't come up with any idea, please help
Apr 12, 2014 at 11:37am
Nested for loop. Inner loop prints one row.

You need something pointing to an element in the input. After printing that element change to point to the next element. If past the end, point to the first again.

You could use pointer or index. With an index one can also make use of the operator %.
Apr 12, 2014 at 1:11pm
Can I use array instead of pointer? As I am not quite familiar with pointer
Topic archived. No new replies allowed.