Answer to Question #160680 in C++ for Nishant

Question #160680

Fill in the blank in the following program that draws a figure resembling the letter 'Z' with sides (50, 100, 50) and the angle between them to be 60 degrees.


Remember that the turtle starts at the center of the canvas and facing right.

left(180); forward(50); right(B1); forward(B2); left(B3); forward(50);


1
Expert's answer
2021-02-02T14:31:59-0500
#include <iostream>
using namespace std;
int main () {
    
    // the shown of letter z
    for (int i = 1; i <= 10; i++) {
        if (i == 1 || i == 10) {
            for (int j = 1; j < 10; j++) {
                cout << "#";
            }
            cout << endl;
        }
        else {
            for (int j = 1; j < 10; j++) {
                if (i + j == 10) {
                    cout << "#";
                }
                else {
                    cout << " ";
                }
            }
            cout << endl;
        }
    }
    // the shown of turtle
    for (int i = 1; i <= 11; i++) {
        for (int j = 1; j <= 11; j++) {
            if (i == j || i + j == 12) {
                cout << "#";
            }
            else {
                cout << " ";
            }
        }
        cout << endl;
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog