im new to C++, for a class i have to create a program where the user enters a number between 1and50, and then outputs * in values up to that number
ex: user enters 4. the program would output:
*
**
***
****
i think im close but dont know how to change number value to *
this is what i have so far, any help is appreciated.
There are a few ways to do this but the one that your instructor probably wants involves nested for loops. The outer one to display the number of lines and the inner one to display the number of asterisks on each line.
A good approach may be to make it output a single line that displays the inputted number, n, asterisks on 1 line. Once that works, place that in a loop to display it n times and adjust accordingly to change the number of asterisks per line.
Two for loops within each other. The outer for loop would increment a counter (named a, for instance). The inner loop would print an asterisk (counter a) number of times.