INPUTTING 2D array

How can I prompt the user to input 2D array contents onto the same line.

Ex. 1 2 3 4 5 6 7

NOT 1
2
3

AGAIN this is for input NOT Output.

----------------------------------------------------------------
CODE
----------------------------------------------------------------

for(int indexRow = 0; indexRow < 3; indexRow++)
{
for(int indexCol = 0; indexCol < 3; indexCol++)
{
cin >> firstMatrix[indexRow][indexCol];
}
}

----------------------------------------------------------------

Very simple concept i just cant seem when prompting the user for input to stop skipping lines. What can i do or use to fix the defualt of skipping a line after each index is registered.
The code you have now should do what you want. The extraction operator will separate reads by any whitespace.
Hi,

I believe that you are using a console for input/output

So if the user enters 1[space]2[space]3[space].............. he/she will be fine

but if you want the user to enter enter after every input then I suggest you look for some functions which set the cursor point (search in cplusplus or google it to find something similar)

hope it helps
Topic archived. No new replies allowed.