0
How to do a nested loops in c++ using letters
4 ответов
+ 2
Loops using letters? I'm not getting that idea. Please rephrase your question and add details in Descripton for better view of the problem.
+ 1
Let me see your code, I'll try to help you once I see what and where your problem is.
0
Doing nested loops in c++ and the output needed is letters not numbers like this
L
LO
LOW
LOWK
LOWKE
LOWKEY
0
First of all, what is a loop? A loop is a construct that executes statements repeatedly until a specified condition is met. The statements are in the block of the loop. In C++, if there is only one statement to be repeated, then there will be no block (braces). There is the do-while loop, while-loop, and the for-loop. Such constructs are called compound statements.
do-while loop
A simple do-while loop is:
int m = 0;
do
{
cout << m << ' ';
++m;
} while (m<5);
There is an initial condition that is not really part of the loop. This initial condition is “int m = 0;”. The loop begins with the reserved word, do, and ends with a semicolon, after the while condition, “(m<5)”. The loop means to print out integers, beginning from zero until m is equal to 5. When m is equal to 5, no printing takes place.
Regards,
J wick