Loop problem while drawing shapes

The following function prints out squares in ascending order (depending on the start and end size). How would I go about making them output in descending order. Example, the starting size be 6 and the end size be 2. When I try I get an infinite loop.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  void draw_square(char &character, int &start_size, int &end_size){
    
    int size = start_size;
    while(start_size != end_size + 1){
        for (int row = 1; row <= size; row++){
            for (int col = 1; col <= size; col++){
                if (row > 1 && row < size && col > 1 && col < size){
                    cout << " ";
                }
                else{
                    cout << character;
                }
            }
            cout << endl;
        }
        size++;
        start_size++;
    }
}
while(start_size != end_size + 1)
to
while(start_size != end_size - 1)

1
2
size++;
start_size++;

to
1
2
size--;
start_size--;
Thank you!
Also, would it be easy to edit this code to draw a triangle rather than a square?
Topic archived. No new replies allowed.