Using Visual C++

Creating a Chapter Workspace
In Visual C++, click on File/New…
Click on the Workspaces tab
Click on Blank Workspace

Type the name of the chapter you are working on (Chapter 3)

Click on the … box next to the Location field to find and select the Programming folder you created in Windows Explorer earlier.

Click OK twice.

Creating a Project

Each exercise or problem requires that a new project be created.

To create a new project do the following:

  • Click on File/New…
  • Click on the Projects tab
  • Click on Win32 Console Application
  • Fill in Project name as follows:
  • Last Name_assignment (use underscore instead of period)

Examples:

milsteadr_ex3_1 (for Exercise 3-1)

milsteadr_prj3_1 (for Project 3-1)

milsteadr_prb3_1_1 (for Problem 3.1.1)

  • Check the radio button next to Add to current workspace
  • Click on OK
  • Click the radio button next to Empty Project
  • Click on Finish
  • Click on OK

Creating a Source Code File

Now that you have a project within a workspace, you need a source code file to type in your source code.

  • On left hand side of screen, click on File View at bottom of left pane
  • Click on Project/Add to Project/New…
  • Make sure Files tab is selected
  • Click on C++ Source File on left side of window.
  • In File name box, type the file name as follows:
  • Login Name_assignment (use underscore instead of period)

Examples:

milsteadr_ex3_1 (for Exercise 3-1)

milsteadr_prj3_1 (for Project 3-1)

milsteadr_prb3_1_1 (for Problem 3.1.1)

(you can also just copy what is in Add to project box above File name box.

  • Click on OK
  • Type your source code in the right hand window.

Important!!!!

All programs must have:

–         on the top line, two forward slashes (//) followed by the file name.

–         on the next line, two forward slashes followed by the title of your program.

–   the following two lines of code before return 0; and the closing brace (}) at the end of the file:

cin.ignore (80, ‘\n’);

cin.get ();

Compiling/Linking/Running the Program

Once your code is entered,

Click on Execute Program (Ctrl-F5)

Click Yes

Messages about your program such as errors and warnings will appear in the window at the bottom of the screen.

When program is finished running, hit Enter twice to close the Console window.

Advertisements

Leave a Comment »

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Entries and comments feeds.

%d bloggers like this: