Visual C++ Tutorial & Basic Concepts
Computer Science and Programming
Dr. Jennifer Kay (with handouts by Rose Boiano and Jennifer Kay)
Background
You will be writing programs, and then compiling and running them. To compile
a program (think of compilation as turning C++ code into a different language that
your PC can run), it must be a part of a Visual C++ "project".
Think of it this way. A program is a lot like a piece of paper with
words on it, and a project is a lot like a big wooden desk.
When you create a new Visual C++ Project, you
are building a new desk to work on. This desk has a special area where
it holds the papers that are most important to you, but there is also lots
of space to hold other papers.
Every time you write a new program, you get out a blank piece of paper and
write on it. You can also, of course, take an old program (a piece of paper
you've already written on) and run it, or modify it and then run it.
When you want to compile and run your program, you have to tell the computer
to remove any other papers from the special space on the desk, and put
your program in the special space. Then you have to tell it to put your
new program in the special space. Finally, you tell it to compile and run what's
in the special space.
This document gives you an outline of how to do different common tasks,
and has links to the following files:
-
Creating a New Visual C++ 6.0 Project: Think
of this as building a new desk. You should only have to do this once for
the entire semester. (Under certain circumstances Visual C++ will mess
up your desk and you'll have to build a new one, if things don't seem to
be working, this may be the problem. BUT, it's fairly uncommon, probably
happens to 5-10% of students over the course of the semester, so
don't worry about it too much.)
- NEW! Opening a workspace you created
earlier:
If you built a desk previously, this lets you retrieve that desk rather than
building a whole new one each time.
-
Creating a New Program in an Existing Visual
C++ Project: Think of this as getting a brand new sheet of blank paper
and putting it on the special space in your desk.
-
Compiling and Running your Visual C++ 6.0 Project:
This is the final step in using your setup. You are telling the computer
to compile and then run what's in the special space on your desk.
-
Removing a program from your project:
Think of this as removing something from the special space on your desk
that you don't need to use for now. It doesn't mean that you're erasing
everything that's on that piece of paper, but you are moving it away from
the special space on your desk.
-
Opening an existing program in your
Visual C++ 6.0 Workspace: You use this when you started writing on
a piece of paper earlier, maybe even made it into a working program, but
at some point you took it off of the special space on your desk. This technique
will enable you to put that old piece of paper back on the special space
on your desk.
 
Before you start to use Visual C++ for the first time
Set up your Computer Science & Programming Folder:
Make a folder on your H drive called CSP
Inside of that folder, make another folder called lab1
(Each week, you'll make a new folder -- lab2, lab3, and so on)
The first time you use Visual C++
Using Visual C++ again to write a new program
Using Visual C++ to look at / run a program you've already written
NEW Opening up your workspace again
(necessary only when you start up Visual C++).
Remove your old program from the project as described in the Removing
a program from your project handout.
Follow the directions in the Opening
an existing program in your Visual C++ 6.0 Workspace handout to open
your program
Follow the directions in the Compiling and Running
your Visual C++ 6.0 Project handout to compile and run your program.
Copyright (c) 2001 Jennifer Kay & Rose Boiano. Permission is granted
to make copies of this for educational purposes as long as it is distributed
for free (or for a minimal copying fee) and this copyright notice remains
intact.
Last modified: Sat Feb 14 22:48:29 2004