Printing a pattern correctly???

This is a discussion on Printing a pattern correctly??? within the C Programming forums, part of the General Programming Boards category; Could someone please take a look at my code and give me a hint as to what I am doing ...

  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!
    Attached Files Attached Files
    Last edited by Basia; 07-01-2002 at 05: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, 02: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21