i need help to draw hollow square . i am done making completely filled square . anyone pls ?

Drawing the hollow square with what? a pencil, javascript, etc..?

Member Avatar for Warrens80

I can do it with a pencil

I can do it with a pencil

Well, if the "completely filled square" is already done, then the hollow square could be done with an eraser!

Here's a hollow square. I think?

#include <iostream>

int main(int argc, char** argv)
{
    unsigned int count = 12;

    for (size_t i = 0; i < count; ++i)
    {
        if ( i == 0 )
        {
            std::cout << std::string (count, 'x') << std::endl;
            continue;
        }
        if ( i == count - 1 )
        {
            std::cout << std::string (count, 'x') << std::endl;
            continue;
        }
        std::cout << 'x' << std::string (i - 1, ' ') << std::string (count - i - 1, 'y') << 'x' << std::endl;
    }

    return 0;
}



xxxxxxxxxxxx
xyyyyyyyyyyx
x yyyyyyyyyx
x  yyyyyyyyx
x   yyyyyyyx
x    yyyyyyx
x     yyyyyx
x      yyyyx
x       yyyx
x        yyx
x         yx
xxxxxxxxxxxx
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.