Lab 1 Shape Drawer
Functions | Variables
lab1.cpp File Reference
#include <iostream>
#include <fstream>
Include dependency graph for lab1.cpp:

Functions

void start ()
 
void go (int x, int y)
 
void setColor (string color)
 
void drawRectangle (int width, int height)
 
void drawCircle (int radius)
 
void end ()
 
int main ()
 

Variables

ofstream fout
 
string _color
 
int _x
 
int _y
 

Function Documentation

◆ drawCircle()

void drawCircle ( int  r)

Draws a circle where the pen currently is with radius r filled with whatever color is currently set.

Example: drawCircle(10) will draw a circle with radius 10 wherever the pen is.

Parameters
rThe radius of the circle to draw.

◆ drawRectangle()

void drawRectangle ( int  width,
int  height 
)

Draws a rectangle with the upper left corner where the pen currently is with the given height and width and filled with whatever color is currently set.

Example: drawRectangle(2, 5) will draw a rectangle with height 2 and width 5.

Parameters
widthThe width of the rectangle to draw.
heightThe height of the rectangle to draw.

◆ end()

void end ( )

Indicates the end of your drawing.

◆ go()

void go ( int  x,
int  y 
)

Moves the pen's position to the given coordinate.

Example: go(10, 5) will cause the pen's position to change to (10,5).

Parameters
xThe x coordinate to move to.
yThe y coordinate to move to.

◆ setColor()

void setColor ( string  color)

Sets the fill color. Call this before calling one of the draw functions.

Example: setColor("#555555") will set the color to #555555 (dark gray).

Parameters
colorThe hexadecimal color code to set.

◆ start()

void start ( )

Indicates the start of your drawing.