Recommended Answers
Jump to PostThere's isn't a magic code to draw 'all shapes'
I guess this is a homework assignment to learn loops?
If yes: Post your attempt here (are tell us what part you don't understand), and you'll get help.
if no: The easiest way to draw the shape in your post is: …
Jump to PostOr else you do a few math calculations, then set up a function to draw individual shapes....
For example, you could create a "square" function:
void draw_square(int sideLength);
which basically loops and outputs a square (of the specified size, using a loop) to the screen...
…
Jump to PostCould any one answer my questions??
I can't figure out what the questions are. The code you posted draws a triangle. Change it slightly to draw a square:
int main() { int n = 4; int line, loop; for (line = 1; line <= n; line++) { …
Jump to PostOur doctor want us learn how to make these shapes by using loops for exam question.
sweet.
my doctor just wants me to bend over and take a deep breath. :(
i should look into changing plans.
.
All 18 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.