Hey guys.

I am currently trying to get to grips with C++ and I am trying to create this little program.

What I am trying to do is create a 'square' program, that prints out the entered number from the user, then prints the *'s to create a square. However, that isn't all.

The user is given options to fill in the square as well.

This is an example:
"Please enter the square’s size: 5
Please enter its type
1: clear
2: filled
3: horizontal lines
4: vertical lines
* * * * *
* *
* *
* *
* * * * *

((It is suppose to be a square -____-'))
Draw another square?
1: Yes
0: No"

And so on.
The user is allowed to carry on or not.

I am struggling as to how I could complete this program.

Has anyone ever done a program like this?
I understand this is a large program, but if anyone could help, that would be great =]

Thanks in advance.

If you are using a for loop to print your stars, why not have another for loop to print spaces? So run one for loop to loop over the # of lines you need and within that have 2 for loops (stars and spaces). Hand code it to convince yourself (e.g., ok so I'm on on lines 0 and N I need x number of stars, so mix in some if statements). It's really not that long of a program once it comes down to it...

Thanks Jonsca.

I think I know what you mean, but would you be able to show me?
I know it is basically asking you to write for me (><') but it is easier for me to understand it, if I can see it.

Sorry to be a pain! XD

You're not being a pain at all. However, I will not write the code for you. I would be glad to walk through (most of) it with you. See if you can put the for loop together to do the solid block, then we can go from there (I think that's the least difficult starting point, 2 for loops one inside the other, one to keep track of rows and the other stars). If you're not comfortable posting your code you can leave just a piece of it. I think it may be a good idea for you to make 4 separate programs initially and then cobble it all together with the "menu" at the very end.

That would be great =]
Thank you for the help.

Ok, so starting the program with the first 'for' loop?

See if you can put the for loop together to do the solid block, then we can go from there

Please show something towards this end. What part is giving you the most trouble? Start off trying to print 1 line of 5 stars (without using a string), then 3 lines.

I think being brain dead at this hour isn't really helping my cause here! XD
I can't even write a valid loop.

I am going to sleep now as I have work tomorrow, but if you are online tomorrow, could we continue when I am not dead? XD

Thanks man!

Surely. A good night's sleep never hurts

I wont it
like that

*  *  *  *
*        *   
*        *
*  *  *  *

I wont it
like that

*  *  *  *
*        *   
*        *
*  *  *  *

By looking at the figure,what can you tell me about the; line by line?

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.