NEED HELP...Please

So my teacher wants us to print user input amount of asterisks, but then he also wants us to separate them into user input amount of groups. I am already able to print out the total amount of asterisks using a 'for' loop, but I am unable to separate them into user defined groups. If someone had a hint, or tip, that would be awesome. Thanks much!

1
2
3
4
5
6
7
8
  void outputAsterisks(int totalAsterisk, int groupAsterisk)
{
    for (int asterisk = 0; asterisk <= totalAsterisk; totalAsterisk--)
   {
       cout << "*";
   }
}
You will need two for loops, one for the amount of groups you will be making, then a nested loop for the amount of stars to print.
'for' loop in a 'for' loop?
1
2
3
4
5
6
7
for ( int j = 0; j < groupAsterisk; j++ )
{
   for ( int k = 0; k < totalAsterisk; k++ )
    {
      //print number of stars then end line.
    }
}

If you input 5 groups, each to print 5 stars, the inner loop will execute 5 times, then go back to the outer loop, increment it, then the inner for loop will run 5 times again.
Topic archived. No new replies allowed.