INTRODUCTION TO
PROGRAMMING IN
C++
Pre-Lab Assignment:
Experimenting with the CMU Graphics Package
Alyce Brady
Kalamazoo College
Familiarizing yourself with the CMU Graphics
Library.*
- The CMU Graphics Package comes with a demo program. Compile and run
this program to get a sense of some of the capabilities of the graphics
package. (Alternatively, replace the demo file in the project with the
simplified ABdemo and compile and run that.)
Your instructor will give you more detailed instructions on how to do
this in your lab.
- Now compile and run the program using the
ABhouse program (which is a subset
of the demo program consisting of just the first screen)
instead of the demo program.
You may need to download the
header file for WaitNClear. Make sure that
the WaitNClear implementation file will be
compiled in as part of your program.
Your instructor will give you more detailed instructions on how to do
this in your lab.
- Once you have the ABhouse program running, edit
ABhouse.cpp.
Notice that the graphics package is accessed through a window object
that "knows" how to draw. The main function instantiates a
window object and "passes messages" to the object telling it to do what
is needed to make the drawing.
- Compared to the size of the house and the size of the windows, the
door of the house is quite small. Modify the two constants that
determine the door size to make it better-proportioned for the size of
the house.
Compile and run the program to test your changes.
Save the modified program.
*The CMU Graphics Library was created by the Carnegie Mellon
University School of Computer Science and is used in their introductory
programming courses. It is available from
Mark Stehlik's
Advanced Placement page.