Thread: Printing a pattern correctly???

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    8

    Printing a pattern correctly???

    Could someone please take a look at my code and give me a hint as to what I am doing wrong. I am trying to print a square pattern out of the type of character and number of characters the user chooses to print.

    ie:

    The user chooses to print to the screen the character $.
    The user chooses to print this character 5 times.

    The output should look like this
    $$$$$
    $$$$$
    $$$$$
    $$$$$
    $$$$$

    Please see attachment of source code I have been working with.
    MY code will print the right amount of characters down but only 2 characters across no matter what number of characters are entered.

    Thank you!
    Last edited by Basia; 07-01-2002 at 04:59 PM.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    for( y = 0; y < rows; y++ )
    {
        for( x = 0; x < columns; x++ )
            print a character
        print a new line
    }
    Use nested loops.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C# Printing Problem
    By silverlight001 in forum C# Programming
    Replies: 0
    Last Post: 03-23-2009, 01:13 AM
  2. Printing Patterns
    By ferniture in forum C Programming
    Replies: 11
    Last Post: 11-17-2008, 10:00 PM
  3. need help printing this pattern
    By Blimpy325 in forum C Programming
    Replies: 4
    Last Post: 03-04-2006, 06:40 AM
  4. Printing a Pattern of Stars
    By ProgrammingDlux in forum C++ Programming
    Replies: 13
    Last Post: 03-01-2002, 08:38 AM
  5. text pattern recognition
    By mtsmox in forum C++ Programming
    Replies: 5
    Last Post: 02-27-2002, 08:38 AM