Need help drawing shapes

I am new to C++, i have this assignment for my programming class in which i have to draw kind of a diamond with '*'. The thing is: it works, but it also draws a pair of '*' on top of the shape, and i don't know why. Any help?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  void main()
{
	int n, m;
	cout << "Type m: ";
	cin >> m;
	cout << "Type n: ";
	cin >> n;

	for(int i=m; i>=0; i--){

		for(int j=i; j>=0; j--)
			cout << " ";
		for(int k=0; k<n; k++){
			if (i==0){
				cout << "*";}
			else if (i==m-1){
				cout << "*";}
			else if (k==0){
				cout << "*";}
			else if (k==n-1){
				cout << "*";}
			else if ((i>0)&&(i<m-1)&&(k>0)&&(k<n-1)){
				cout << " ";}}
		cout << endl;
	}

	char fin;
	cin >> fin;
}
New algorithm that works :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>

using namespace std;

int main()
{
	int n, m;
	cout << "Type m: ";
	cin >> m;
	cout << "Type n: ";
	cin >> n;

	// m : row
	// n : column
	for(int a = 0; a < m; a++)
	{
		for(int b = 0; b < (m - a); b++) cout << ' ';

		cout << '*';
		
		if(a == 0 || a == (m - 1))
		for(int c = 0; c < n - 2; c++) cout << "*";
		else
		for(int c = 0; c < n - 2; c++) cout << " ";

		cout << '*';
		cout << endl;	
	}

	char fin;
	cin >> fin;
}


Type m: 20
Type n: 25
                    *************************
                   *                       *
                  *                       *
                 *                       *
                *                       *
               *                       *
              *                       *
             *                       *
            *                       *
           *                       *
          *                       *
         *                       *
        *                       *
       *                       *
      *                       *
     *                       *
    *                       *
   *                       *
  *                       *
 *************************
Topic archived. No new replies allowed.