Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. display solid square program

display solid square program

Scheduled Pinned Locked Moved C#
tutorialarchitecture
9 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Missy Glory
    wrote on last edited by
    #1

    hi... how to display a solid square composed of a character input. for example: square size = 4 fill character = # result: #### #### #### ####

    V C P M 4 Replies Last reply
    0
    • M Missy Glory

      hi... how to display a solid square composed of a character input. for example: square size = 4 fill character = # result: #### #### #### ####

      V Offline
      V Offline
      Vikram
      wrote on last edited by
      #2

      use 2 for loops ... simple program.. Vikram I Code...

      C K 2 Replies Last reply
      0
      • V Vikram

        use 2 for loops ... simple program.. Vikram I Code...

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • V Vikram

          use 2 for loops ... simple program.. Vikram I Code...

          K Offline
          K Offline
          Keshav V Kamat 0
          wrote on last edited by
          #4

          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

          K D 2 Replies Last reply
          0
          • K Keshav V Kamat 0

            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

            K Offline
            K Offline
            Keshav V Kamat 0
            wrote on last edited by
            #5

            yes. it can be done using a single loop as well

            Keshav Kamat :) India

            1 Reply Last reply
            0
            • M Missy Glory

              hi... how to display a solid square composed of a character input. for example: square size = 4 fill character = # result: #### #### #### ####

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              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 )

              1 Reply Last reply
              0
              • M Missy Glory

                hi... how to display a solid square composed of a character input. for example: square size = 4 fill character = # result: #### #### #### ####

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • K Keshav V Kamat 0

                  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

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #8

                  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

                  1 Reply Last reply
                  0
                  • M Missy Glory

                    hi... how to display a solid square composed of a character input. for example: square size = 4 fill character = # result: #### #### #### ####

                    M Offline
                    M Offline
                    Muammar
                    wrote on last edited by
                    #9

                    Yet another homework poster:sigh:


                    Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups