I am just a beginner in programming, i'm just in my first year so i dont know many things in C++.. My professor gave us a project that will create an isosceles triangle that measures 5 in its two sides and 9 for the base.. I tried searching but still i cannot do the program, we are only allowed to use nested for loop.. this should be the output..
Can you do it all (ignoring the requirement to use loops)?
If you can, do so. Once you've done it by yourself, you ought to see at least one pattern emerge. Of course, if someone else does it for you, you won't see it.
Then you can try to use the pattern improve your program.
make basic counter before first loop.
use setw (counter);
counter shall indicate how many whitespacess will be there for each output line
counter shal be then for each for loop something like setw (counter -= (counter / 2)) for each nested for lopp
that will reduce how many whitespaces are between # # #
than next line # # # # and so on.
AND use break to stop cout between first # and last # in current line
for example
1 2
for (short i = 0; i < 6; i++)
if (i <= 2 ) break
to enshure u cout only 2 of # in current line
AND FOR last line skip that rule using if statement too to cout full line of ####### where setw (counter = 0);