Always use { } to make your code readable and consistent.
This then no longer will be a problem.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
ok , i did that, but it's still doesn't recognise 'i' in the second for loop.
That's because you didn't define it in the second loop. You only definedi in the first loop.
(Yeah i know i shouldn't be using _getch(), i'll get around to sorting that out.)
Why "get around" to it? Just use cin.get() and be done with it...
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
That's because you read the number from your input but not the NewLine you also pressed. Loop up cin.ignore ...
I'm surprised the _getch didn't do the same thing...
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944