-
Outputing a square.
so my only question is how to make my output screen like this:
****
****
****
****
instead of this:
*
*
*
*
Heres the code: I jus basically need the answer, i can figure it out from the code you use. THX
Also this is a function im calling, not the entire program.
void display()
{
char ch;
int i, j, side;
cout<<"Enter character and side"<<endl;
cin>>ch>>side;
cout<<endl;
for(int i=0; i<side/2; i++)
{
for(int j=0; j<side/2; j++)
{
cout<<ch<<endl;
}
}
}
-
Re: Outputing a square.
Quote:
Originally Posted by
Jinzui
What do you think this "<<endl;" does?
-
Re: Outputing a square.
void display()
{
char ch;
int i, j, side;
cout<<"Enter character and side"<<endl;
cin>>ch>>side;
cout<<endl;
for(int i=0; i<side/2; i++)
{
for(int j=0; j<side/2; j++)
{
cout<<ch;
}
cout<<endl;
}
}
I don't know why you are doing side/2. I think it should just simply be side.
-
Re: Outputing a square.