INTRODUCTION TO
PROGRAMMING IN
C++
Kalamazoo
College
LAB
2: LAB
ENTRANCE
ASSIGNMENT
Familiarizing yourself with the CMU Graphics
Library.*
- Copy the Graphics Demo folder from "\\Dragon\cls_abrady\CS 420\" to
the Temp folder of your PC.
Open the project (the graphics-prj file within that folder)
and run the demonstration program in the project to get a sense of some
of the capabilities of the graphics package.
- Replace the ABdemo.cpp file in the project with the
ABhouse.cpp file (which is a subset of the demo program
consisting of just the first screen). To do this, highlight
ABdemo.cpp in the project window and then choose Remove
Selected Items from the Project menu. Then drag-and-drop the
ABhouse.cpp file from the Graphics Demo folder to the spot in the
project window where you just removed the ABdemo.cpp file.
Run the program (CodeWarrior will automatically do any necessary
compilation and linking) and make sure that it works.
- Double-click on ABhouse.cpp in the project window to open
it for editing.
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.
Run the program to test your changes (again, CodeWarrior will
automatically do any necessary compilation and linking).
Save the project to your floppy.
- Remove the object code from the project (there is an option under the
Project Menu to do this). You may also need to remove the executable
file(s) from the Graphics Demo folder (named Graphics App ..., unless you
changed the name of the Target File) to fit everything on your floppy disk.
Copy the Graphics Demo folder
from the Temp folder to your floppy disk. You should then remove the
folder from the Temp folder on the C: drive.
*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.