Can you give an idea how  to create this pattern:7.  Write a program to display the following pattern

                                                 x x x x x
                                                 x x x x x 
                                                 x x x x x 
                                       x x x x x x x x x x x x x x x
                                       x x x x x x x x x x x x x x x
                                       x x x x x x x x x x x x x x x
                                                 x x x x x
                                                 x x x x x 
                                                 x x x x x 
    I know it should be simple enough 
    I just starting c++ and would like to see the process.My guess is: need to use 
    for loop and if statement,but how to combine it together?Regards

Start by printing a block of x's:

for (int i = 0; i < 9; i++) {
    for (int j = 0; j < 15; j++) {
        cout.put('x');
    }

    cout.put('\n');
}

From there you can play around with ideas on how to identify the corner blocks and instead of printing an x, print a space. The real benefit of this exercise is that part, so I don't want to reveal too much as that would defeat the purpose.

instead of printing an x, print a space.

yes. you have to print some spaces using another loop. but try it yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.