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
#include <iostream>
usingnamespace 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