Star Pattern Programming Help Asap!!

I am trying to add a simple void function to a program.

This what I have
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void StarPattern2() {
    int max_stars = 7;
    int min_stars = 1;

    while (max_stars > 0) {
        while (min_stars <= max_stars) {
            cout << "*";
            min_stars += 1;
        }//end while
	max_stars -= 1;
	min_stars = 1;
    cout << endl;
	} //end while
}

This display only this
*****
****
***
**
*
But I need one single void function where I can display this. Or at least two void functions.
*
**
***
****
*****
*****
****
***
**
*
With all due respect, this is not pattern programming, this is "fool" programming. The term pattern programming has a deeper and more meaningful meaning. I think that's why no one answered you... because the subject of your question looks way fancier than how trivial your question is.

Anyway, the solution is just start an opposite loop. So something like

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

int max_stars = 1;
int min_stars = 1;

while (max_stars <= 5) 
{
        while (min_stars <= max_stars) 
        {
            cout << "*";
            min_stars += 1;
        }
	max_stars += 1;
	min_stars = 1;
    cout << endl;
}
Actually I tried it again and it is working thank you very much
Last edited on
Topic archived. No new replies allowed.