I need help asap making a square with a pattern inside

I need to create a square with a pattern inside of it using only FOR Loops and If-Else statements. Instructions state that I cant just output the square using cout. Thanks in advance

This the pattern I need to create
1
2
3
4
5
6
7
*******
**   ** 
* * * *
*  *  *
* * * *
**   **
*******



This is what I have so far.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
using namespace std;

int main()
{
	int row, col;
	cout << endl;

	for(row = 0; row <= 6; row++)
	{
		for(col = row; col <= 5; col ++)
		{
			cout << "*";
		}

		for(col = row; col >= 0; col --)
		cout << "*";
		cout << endl;
	}
	return 0;
}
The following loops will probably make things easier for you:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
using namespace std;

int main()
{
	int row, col;
	cout << endl;

	for(row = 0; row <= 6; row++)
	{
		for(col = 0; col <= 6; col ++)
		{
			// If it's the top row or bottom row, then output a star
			// If it's the left-most column or right-most column, then output a star
			// If row == column, then output a star (this is the downward-sloping diagonal
			// Some other condition for the upwards-sloping diagonal
			// Other wise output a " "

		}
		std::cout << std::endl;
	}
	return 0;
}


You just need to work out how to form the if-else statements inside the col loop
Topic archived. No new replies allowed.