display solid square program
-
hi... how to display a solid square composed of a character input. for example: square size = 4 fill character = # result: #### #### #### ####
-
hi... how to display a solid square composed of a character input. for example: square size = 4 fill character = # result: #### #### #### ####
-
It can be done in one loop, if you use
new string('#', squareSize)
to output a row.
Upcoming events: * Glasgow: Introduction to AJAX (2nd May), SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
ya. use a couple of loops. something like this. since you have asked for 4 hashes on 4 lines, use something like this.
for(int i = 0; i < 4; i++)
{
for(int j = 0; j < 4; j++)
{
Console.Write("#");
}
Console.WriteLine();
}Keshav Kamat :) India
-
ya. use a couple of loops. something like this. since you have asked for 4 hashes on 4 lines, use something like this.
for(int i = 0; i < 4; i++)
{
for(int j = 0; j < 4; j++)
{
Console.Write("#");
}
Console.WriteLine();
}Keshav Kamat :) India
yes. it can be done using a single loop as well
Keshav Kamat :) India
-
hi... how to display a solid square composed of a character input. for example: square size = 4 fill character = # result: #### #### #### ####
This is obvioulsy homework, I am sorry that someone did it for you. It won't help you learn. Now that you have the code, look at it, think about how it works, and what you were supposed to learn from writing it yourself.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
hi... how to display a solid square composed of a character input. for example: square size = 4 fill character = # result: #### #### #### ####
OK - you've posted the same question twice now. You should reply/add clarifications on the one below, plus you really shouldn't try to get us to do your homework for you. That's just lazy, and you will come away with the only lesson learned being that we know more about programming than you do.
Deja View - the feeling that you've seen this post before.
-
ya. use a couple of loops. something like this. since you have asked for 4 hashes on 4 lines, use something like this.
for(int i = 0; i < 4; i++)
{
for(int j = 0; j < 4; j++)
{
Console.Write("#");
}
Console.WriteLine();
}Keshav Kamat :) India
Wow. Nothing like doing his homework for him! Great! Now he didn't learn a thing and will fail on the next project.
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
hi... how to display a solid square composed of a character input. for example: square size = 4 fill character = # result: #### #### #### ####