-1

how can I GET A EMPTY SQUARE İN C++ LİKE THİS;
* * *
* *
* * * PLS HELP ME

Edited by mzn: n/a

Votes + Comments
Read the rules please
4
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by WaltP
0

My advise for you, first try to think and solve this problem by your own if even so you don't get to a conclusion of the problem then come back here and post what you have done so far, just don't come here and expect everyone to do all the work for you.. you must first show some effort.

Jiwe

0

ı wrote smthing but it gives infinite stars

#include <iostream>
using namespace std;
int main()
{
	int i,j,n;
	cout<<"enter the a side of square";
	cin>> n;
	for(i=1;i<=n;i++)
	{
		cout<<"*";
	
	for(j=1;j=n;j++)
		cout<<"*";
    
    return(0);
    }
  }

by the way asking for something means not always get smthng effortless..

Edited by WaltP: Added CODE tags -- with all the help about them, how could you miss using them????

0

It's easy,

INPUT size of square side
OUTPUT size times *
OUTPUT * then output size-2 times space then output *
do this size-2 times
then finish it with
OUTPUT size times *

Try to translate this into c++

Hope this helps

0

for(j=1;j=n;j++) You are not comparing j with n, you are setting j to n, therefore an infinite loop.

You need to think deeper about what you are trying to accomplish. Use pencil and paper to figure out what kind of loops you need, and how many.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.