Otherwise there's no real telling what's going on in that while loop. Assuming you initialised j to 0, that while loop will only ever run once because you don't reset j anywhere.
When I run it, it prints out a multiplication table correctly.
12 rows and 10 columns, which is what's specified.
Look at what you're effectively saying:
- First iteration of loop, n=1:
- Set j to 1.
- For all values of j between 1 to 10, print 1 * j.
- Print an endline
- Second iteration of loop, n=2:
- Set j to 1.
- For all values of j between 1 to 10, print 2 * j.
And so on. All the way up to and including n=12.
Functionally, this is fine. What are you expecting it to do?
Actually just now I'm trying to change the inner loop to "for loop" and outer loop to "while loop" but accidently deleted j=1; in line 13, then i compile the program and get the value 0-10 (which I don't know where it comes from)...
but if I deleted the whole while loop(code below), the ouput doesn't shows any value instead of the cout things only...which is true...(meaning that if got while loop but no initialize j=1, the ouput is 0-10<-which I don't know why since while loop is not execute at all if no initialize j right? But there is still a output... This is my question...TQ...)