CSCI 201 Lab 1 -- Compiling with Visual C++

Starting

Start Visual C++ 5.0 by going through the following sequence of menu selections from the Start button Yes, that is Microsoft Visual C++ 5.0 twice.

At this point, you should see two windows. The larger window is the primary window of the Visual C++ development environment.
Visual C++ main window
A second smaller floating window displays the InfoViewer. We will not use the InfoViewer window in this lab.
Visual C++ InfoViewer window
By the way, Visual C++ 5.0 may have a slightly different look when installed on your home PC.

Creating a workspace and projects

In Visual C++, software in developed in projects which are contained in workspaces. Select File from the menu bar and then choose New. A dialog window will be displayed. If necessary, select the Projects tab.

In the left hand panel, select Win32 Console Application. On the right hand side, give lab01 as your Project name and c:\files\lab01 as your project Location.

Your dialog window should look like the following graphic before you confirm your selection with the OK button. project selection dialog

The sub-panel in the upper-left hand corner of your Visual C++ window displays information about your workspace. It should now look like:
classes subpanel

Creating a C++ file

Again select File followed by New from the menu bar. This time make sure the Files tab is selected. Now select C/C++ Source File as your file type and choose lab01.cpp as your File name.

Ugh -- got the wrong type highlighted in the figure
file selection dialog

Move your mouse into the upper-right panel and start typing the following program:
C++ program
Notice all the pretty colors Visual C++ uses to display your program. Be sure to include your name in a comment at the beginning of all C++ programs you write for CSCI 201!

Building your program

Somewhere new the top right of your Visual C++ window, you should see the following row of six icons.
Visual C++ tools
Slowly move your mouse over these icons to see their function. Go ahead and press the second icon. It should Build your program.

If you didn't make any typing mistakes, you should see the following displayed at the bottom of the window.
lab01.exe - 0 error(s), 0 warnings(s)
If you did make a mistake, correct it and keep building until you get the message

Running your program

Now press on the Execute Program tool. It's the big exclamation mark. You should see a screen similar to:
Program output
Press the space bar and the window will disappear.

Lab Checkoff 1

Whenever you see the section heading Lab Checkoff you must get the attention of your instructor and have she/he verify that you have completed some activity.

Ask your lab instructor to verify that your C++ program runs.

Saving your program on a floppy

The files Visual C++ has generated in building your programs are much too large to copy into a floppy disk to take home. You must "clean up" your workspace to make it fit on a floppy.

Move your mouse over to the Project Workspace window and mash the FileView tab. Use your mouse to select the project. Your window should resemble:
FileView window
Click on the right mouse button. A pulldown menu should appear. Select the item

This will delete unneeded "intermediate" files from your workspace.

Copy your workspace onto your floppy by performing the following steps.

  1. Double-click the My Computer icon on the desktop.
    My Computer window
  2. Double-click the C: drive in the My Computer.
  3. Double-click the files folder.
    C:\files window
  4. Press on the lab01 icon and drag it to the icon for the A: drive.

Lab Checkoff 2

Ask your lab instructor to verify that your program is stored on your floppy disk.


Return to CSCI 201 page
CSCI logo Return to the UNCA Computer Science home page