Take a look at the following sites to see how loops are taught and accomplished in Java or C++
C++ http://www.cprogramming.com/tutorial/lesson3.html
Java http://www.tutorialspoint.com/java/java_loop_control.htm
C++ http://www.cprogramming.com/tutorial/lesson3.html
Java http://www.tutorialspoint.com/java/java_loop_control.htm