|
-
March 23rd, 2010, 06:25 PM
#1
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;
}
}
}
-
March 23rd, 2010, 08:20 PM
#2
Re: Outputing a square.
 Originally Posted by Jinzui
What do you think this "<<endl;" does?
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
March 23rd, 2010, 10:40 PM
#3
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.
Last edited by sgsawant; March 23rd, 2010 at 10:43 PM.
Reason: I clicked submit accidentally.
-
March 24th, 2010, 03:12 AM
#4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|