Good day!
can you guys help me
to have the code for this output? pleasee..
_ _ _ 1
_ _ 2 2
_ 3 3 3
4 4 4 4
thanks in advance!
cout<<"_ _ _ 1";
cout<<"_ _ 2 2";
cout<<"_ 3 3 3";
cout<<"4 4 4 4";
Thanks for the help
but I need the nested loops...
what have you done so far ?
for (int i = 0; i < 1; ++i) {
for (int j = 0; j < 1; ++j) {
cout<<"_ _ _ 1" << endl;
cout<<"_ _ 2 2" << endl;
cout<<"_ 3 3 3" << endl;
cout<<"4 4 4 4" << endl;
}
}
thanks for the help
but it doesn't work...
i need a loop for the new space
another loop for the underscore (_)
and a loop for the numbers...
it compose 3 loops
a loops within a loop..
Okay, so you've started to plan out what you need, that's a good thing. Start trying to code it.
-Can you make the numbers increase over each row.
-Do the counts of the elements in the rows bear any relation to other variables?
Plan out what you want with pencil and paper and then try to translate it into code.
for (int i = 0; i < 100000000; ++i) {
for (int j = 0; j < 100000000; ++j) {
for (int k = 0; k < 100000000; ++k) {
cout<<"_ _ _ 1" << endl;
cout<<"_ _ 2 2" << endl;
cout<<"_ 3 3 3" << endl;
cout<<"4 4 4 4" << endl;
}
}
}
That should do the trick, it might take a while but the end result will work. Just wait
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.