Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Displaying patterns in c++

  • 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, Registered Users 2 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