Ive been working on this code for a bit but cant figure out what im doing wrong, If someone could have a look Id appreciate it a lot. Thanks! heres what its suppose to do:

Write a function that displays the left margin of the screen a solid square of a
character whose side is specified in integer parameter side. For example if the
character is ‘*’ and side is 4, the function displays
****
****
****
****

#include <iostream>
#include <conio.h>

using std::cin;
using std::cout;
using std::endl;

int main ()

{
	int side;

	cout << "This program will display a solid square of asterisks whose side is specified by the user." << endl;

	cout << "Please enter an integer specifying the length of the side." << endl;
	cin >> side;

	for ( int i = 0 ; i < side ; i++)

	{
		cout << " * " << endl;


		for ( int j = 0 ; j < side -1 ; j++)

		{

			cout << " * " << endl;

		}

	}

	getch(); 
	return 0;
	

}

You don't need line 22. Also, in line 25, you should have j<side as well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.