



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Lab; Class: Programming I; Subject: Computer Science; University: Harding University; Term: Fall 2007;
Typology: Lab Reports
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Lab # 1 - Your First C++ Program Name ___________________________________ COMP 150/ 10 Points
The goal of this lab is to become familiar with the Microsoft Visual Studio .NET 2005 IDE (Integrated Development Environment), to compile and run a C++ program, and to observe several types of common compile-time errors. The IDE provides a broad set of development tools for completing, testing, and refining your program.
In this step you will create a project that contains a single C++ source file.
C. Type “lab1” for the Name of your project. Then change the Location to M:\Projects. This will save your work to the networked M drive which is accessible from any Harding computer.
D. Press the “OK” button. This will close the dialog box and display an application wizard. Press Next and then check the “Empty project” checkbox. Then click the Finish button. A “solution” named lab1 will be created along with the project lab1. A solution can contain one or more projects. In this case, the lab1 solution contains the lab1 project. Usually the project and solution names will be the same.
your file. Once the file is saved, the asterisk will disappear. Note that even if you do not save your program, Visual C++ will automatically save it for you when you compile your program (in the next step).
1>------ Build started: Project: lab1, Configuration: Debug Win32 ------ 1>Compiling... 1>dec2bin.cpp 1>Linking... 1>Embedding manifest... 1>Build log was saved at "file://m:\Projects\lab1\lab1\Debug\BuildLog.htm" 1>lab1 - 0 error(s), 0 warning(s) ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
In this step you will run your program and make some observations about it.
Note: Occasionally when you make changes to your program and attempt to run it before building it, the following dialog box will appear:
Just press the Yes button, and the project will be re-compiled before running. If there were errors in your program, you will see the following dialog box:
Just click No and try to fix the error(s).
In this step you will introduce some errors into the program in a controlled manner to observe the messages reported by the compiler. This will assist you in “debugging” your programs when you encounter these error messages in the future.
#include
Now rebuild the program. This “typo” will generate quite a few errors? Record the first error message you see in the dialog box at the bottom of the VS IDE. Then restore line 10 to its original value before proceeding.
//#include
Notice that this generates a ton of errors. Look for a line that begins “1>m:\projects\lab1\lab1\dec2bin.cpp(21)”. This error corresponds to line 21. Record the error message for line 21 below.
Since iostream is the library which defines cout, cin, and endl, commenting-out the header file hides the definition of these from the compiler. Be sure to restore line 10 to its original state before proceeding.