Laboratory 1: Compiling, running and debugging C++ programs
1. Start up Microsoft Visual
- Download the following files into an empty directory.
- Example 1: Project name "small"
- Example 2: Project name "inches"
- Example 3: Project name "intstack"
- Compile and run the programs above using Microsoft Visual
2. Create a project.
Select "Visual C++
in "Project Types".
Select "Win32 Project"
Choose a project name
indicated in each examples).
Choose the project
location (directory). (OK.)
Click on "Application
Select "Console application"
"Empty project" option. (Finish.)
3. Add files to project.
For each file that
belongs to this project, do:
file (browse to select the downloaded file). (Open).
4. Check that everything has
Double click on each of
folders to check contents.
The *.cpp files should
under "Source Files" and the *.h files should be under
5. Compile and link all
within the project.
6. Run the program.
Your program will be
and a console will pop up.
- Study and play with each program.
Look at the files for this program (starting from main()), and try to
the behaviour of the program.
Check your guess by running the program.
Study the program and the meaning of various "elements" of the language
your TA at the lab or check at a book later on to understand these
Fell free to play, modify and experiment with small changes to the
Play with the debugging tool by:
- Adding a breakpoint (Click the right button of
mouse. Click on "Insert BreakPoint".) .
- Running the program step-by-step (Debug>Start.
Then F10 or F11.)
- Checking the status of the local variables in the