Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Displaying patterns in c++

Options
  • 05-11-2014 11:12am
    #1
    Closed Accounts Posts: 4


    I'm fairly new to c++ and programming in general. I'm trying to figure out how to display a pattern. I know I need to use nested for loops but after hours of doing my head in, I can't figure it out. The pattern is this:
    xxxxx
    xxxxx
    xxxxx
    xxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxx
    xxxxx
    xxxxx
    xxxxx

    I need to display the pattern with the spaces too. 3 rows of 5 x's, 3 rows of 15 x's then 3 rows of 5 x's.

    Any help at all?


Comments

  • Registered Users Posts: 7,157 ✭✭✭srsly78


    Well here is how to do a newline:
    std::cout << std::endl;

    Which bit are you stuck with? Post up what you have attempted so far.

    To get started: copy paste the usual "hello world" program then start putting loops and stuff in.


Advertisement