• Home
  • Textbooks
  • You Can Do It!: A Beginners Introduction to Computer Programming
  • You CanWriteaMenu

You Can Do It!: A Beginners Introduction to Computer Programming

Francis Glassborow

Chapter 8

You CanWriteaMenu - all with Video Answers

Educators


Chapter Questions

02:47

Problem 1

Use the above function declarations (from flood_fill.h and shape.h) to write an implementation (definition) of:
void filled_polygon(fgw::playpen \& pp, shape const \& s, fgw: :point2d centre, fgw: :hue);
Then write a program to test your function. You can use the myshape.txt file you created in Chapter 6 as the source of a shape for this program.

MS
Malcom Smith
Numerade Educator
02:10

Problem 2

Write and test a function that will display a solid (filled in) regular polygon given the number of sides, the center, the distance of the center to a vertex and the color. You might start by writing a function that will do this with the center at the origin.
For bonus points enhance your function so that you can specify a rotation.

MS
Malcom Smith
Numerade Educator
02:47

Problem 3

Write a function that will display a solid disk on the screen given its center, radius and color.

MS
Malcom Smith
Numerade Educator

Problem 4

Enhance the art menu program to utilize the functions you wrote for Exercises 1, 2 and 3.

Check back soon!

Problem 5

Go back to the art menu code and add in menu choices to load a shape from a file. Note that this will entail capturing the file name and using fgw : :open_ifstream $\mathrm{O}$, declared in fgw_text.h.

Check back soon!