Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Simple Graphics [9/15]

This program draws three discs and one line.
[Run the program]

Single-line comments can also be written after symbols << . That kind of a comment is the same as the one after symbols /// .

Exercise 1

Exercise Square 1 output image

Draw a line connecting the red disc and the purple disc.

Solution

line(300, 200, 300, 500);
Exercise Square 2 output image

Exercise 2

Draw a brown disc so that the discs form a square.

Solution

disc(600, 500, 20, /brown);
Exercise Square 3 output image

Exercise 3

Draw the remaining two sides of the square.

Solution

line(300, 500, 600, 500);
line(600, 200, 600, 500);

Loading...