CS182 -- Lab 1: Microsoft Visual C++



->Courses
->CS182
-->Homework
-->Quiz 1
->Lab 1
-->Lab 2
-->Lab 3
-->Lab 4
-->Lab 5
-->Lab 6
-->Project
->Electronic Submission
->MSVC Info
->Tentative Schedule
->Course Policies

[Courses]
[Rich][Home][Rich]
[Author]

Winter Quarter 2000-2001

I look forward to the invention of faster-than-light travel. What I'm not looking forward to is the long wait in the dark once I arrive at my destination.
Marc Beland

Overview

In this lab, you will become familiar with the Build procedures for Microsoft Visual C++ 6.0.

Procedures

You will:

  • In groups of three, develop an algorithm (pseudocode) that will solve the following problem:

    Suppose Superman were to travel at 1.3 times the speed of light (300,000,000 meters/sec) for 10 minutes. Suppose further that his destination was only illuminated by a spotlight located at Superman's point of origin. Calculate how long Superman would wait in the dark if he turned the spotlight on immediately before beginning his travel.

  • As a class, we will write a C++ program that implements the algorithm to solve the above problem.
  • Individually enter, compile, build, and test the program.
  • Individually report on your results and include the answers to a set of questions (see below).

Specifics:

  1. Before going any further, you may wish to create a folder for all of your CS-182 lab projects in the My Documents folder on your computer. You can do this with Windows Explorer.
  2. Start the Microsoft Developer Studio; the procedure may be a little different depending on the computer you are using, but it often involves the Start menu in the lower-left corner of your screen.
  3. Create a new project called lab1.
    • Select New... from the File menu.
    • In the New dialog box, select the Projects tab (it may be selected already).
    • In the list on the left, select Win32 Console Application.
    • Enter the location where you would like your project be created (for example: C:\My Documents\CS182\) in the Location field. Do this first, before entering a name in the Project name field.
    • Enter lab1 in the Project name field. (Note: there is no requirement that the project name be the same as the main source file name, but many programmers like to do it this way.) Note that the Project name field changes to become c:\My Documents\CS182\lab1, the directory in which your project will be created.
    • Make sure the Create new workspace choice is selected.
    • Under Platforms, Win32 should be checked (it will likely be the only choice).
    • Click the OK button.
    • In the Win32 Console Application - Step 1 of 1 window, be sure that An empty project is selected and click the Finish button.
    • Click the OK button on the New Project Information window.

    This will create a new project called lab1 in the directory c:\My Documents\CS182\lab1. If you look in this directory, you will see several files with names that begin with the project name (here, lab1), but don't worry too much about them at this point.

  4. You now need to create a source file so that you have a place to type in the C++ program we develop as a class:
    • Select New from the File menu.
    • In the New dialog box, select the Files tab (it may be selected already).
    • Select C++ Source File (or C/C++ Header File, if you are creating a ".h" file) in the Type list.
    • Make sure the Add to project: box is checked, and that your project name is listed below it.
    • Type the name of your file in the File name box, making sure that the Location field is correct (e.g., c:\My Documents\CS182\lab1).
    • Click the OK button.
    • A window will appear in which you may type your source code and then Save it.

    If you already had an existing source file you could avoid retyping it by including it in the project. The follow procedure can be used to add and existing source file to a project:

    • On the Project menu, select Add to project->Files ...; in the Insert Files into Project dialog, select the appropriate source file from the list (it should be the only file listed) and then click on the OK button.
    • To view or edit your source file, select Open on the File menu, select your source file again, and click on the Open button. (Another way to open your file is to double-click on its name in the FileView list on the left side of the screen, but that's a little more complicated.)
  5. There are several other ways to do this, so ask the instructor if you are having any difficulty.

    In the future, when you modify your program, be sure to open the existing project by selecting Open Workspace ... from the File menu.

    You should become very familiar with this and the previous step as these two steps can be used to create new workspaces for future lab assignments.

  6. Now type in the source code that we developed in lab.
  7. Next build the project. On the Build menu, select Rebuild All. If you get errors you don't understand, it is possible that your compiler options (e.g., file directories and library selection) are not set properly. Consult the instructor for assistance.
  8. Select the Execute program icon or press Ctrl+F5. (If you want to debug, select the Go icon or press F5).
  9. Test the program by running it to see if it produces reasonable values. (Of course, this is not a complete test.)
  10. Submit the lab report (details below).

Lab report (due 11:00pm, the day prior to week 3 lab)

The lab report should be self-contained. That is, it should be possible for someone to understand what you did and why without seeing anything other than your report. Your report should include:

  • Purpose (educational objectives)
  • Problem Statement
  • Algorithm designed by your group
  • Documented source code for your program.
  • Discussion (sample program output, problems you encountered (and how they were overcome), etc.)
  • An estimate of how much time you spent on the assignment.
  • Conclusions (what you learned, suggestions of how the assignment could be improved, things you would have done differently, etc.)

As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost. It may be wise to keep a diskette backup as well.

Your grade will depend on quality of design, clarity of code and documentation, as well as whether your program produces the correct results. If you have any questions, consult your instructor.

© 2001 Dr. Christopher C. Taylor Office: CC-27C Phone: 277-7339 Last Updated: January 3, 2001
I am responsible for all content posted on these pages; MSOE is welcome to share these opinions but may not want to.