CSCI 1300 - Exercise 3
Loops and BGI Graphics

What You'll Get from This Exercise

This exercise is to supplement your reading on loops. It also introduces you to the BGI collection of graphics functions that we'll use to draw objects from within a C++ program.

PC Labs in the
Engineering Center
CR 235    CR 239
CR 244    CR 252 (24 hours)
CH 107    ME 107
Other campus sites are
listed at

Installing the
CS1300 Software
Open a DOS window. If the CS1300 software is not permanently
installed on your machine, then use one of these methods:
If you get the message "Out of environment space", then:
  • Click on the MS-DOS icon in the top left corner of the window.
  • Select Properties from the pop-up menu.
  • Select the Memory tab from the command box.
  • Click the arrow on the Initial Environment box. Move down in the box as far as possible (by clicking the downward arrow). Click on the biggest number that you see in this box.
  • Click OK in the command box.
  • Click OK in the MS-DOS Prompt information box.
  • Stop the DOS Session by clicking the X in the top-right or by typing the command "exit".
  • Restart a new DOS session and try running your commands again.

Getting the Demonstration Programs

Start this exercise by opening a DOS window and making sure that the CSCI 1300 software is available. Create a directory to work in, then copy these files to your working directory:

You can copy these files from your installed cs1300\lab\ directory or right click on the names above to download them.

The Purpose of loops.cxx

Putting some breakpoints in the program

Running the Program up to the Breakpoint

Setting Watches

Seeing the While-loop in Action

Running to the Second Breakpoint

Stepping into the future_balance Function

Seeing the For-loop in Action

The Initialization Clause of the For-Loop

The Repetition Test Condition

Executing the Body of the For Loop, and the Update Clause

Execute the For-loop to Completion

Introduction to BGI

Run the Demonstration Program

A Simpler Graphics Program for You To Modify

More BGI Functions