1. Start Visual Studio as follows: MS Visual Studio.Net 2008 Tutorial 2. Once you have started Visual Studio you should see a screen similar to the following image:
3. Click the menu item File New Project... or press CTRL+SHIFT+N or click the Create Project link. A dialog box is displayed. In the left pane expand the selection named Visual C++ Projects and then select Win32. In the right pane, select Win32 Console Application. In the Name: text box type lab1in. In the Location: text box, type c:\temp Make sure Create directory for solution is not checked Your dialog box should appear as follows:
Press OK and you should see the following window:
Click the link on Applications Settings and you should see the following: Check Empty Project and the dialog window should now look as follows (next page):
Press Finish and your screen should look as follows: Close out the Start Page and the main window should look as follows:
Add a new item (e.g., source file) as follows (Right Click on lab1in): Upon selecting Add->New Item, your screen should now look as follows:
Select C++ File (.cpp) It should be automatically selected for you. Enter the following for the Name field (lab1inp1.cpp) while the Location field is automatically generated for you: Press Add and your screen should look as follows:
Enter C++ source codes: In the large window provided, enter your C++ source code. Sample Code: //Joe Smith (Replace with your name) //lab1inp1 (This is your assignment number) //Displays your name, address, city, state and zip code #include<iostream> using namespace std; int main() { //Display the name, address, city-state-zip cout << "Joe Smith\n" << "1215 Main\n" << "Conway Ar, 72035\n"; } return 0; Build the Program (read this part carefully!!!): After you have completely entered your program, you must build it using Build->Build Solution as shown below. The output window at the bottom of the screen will show the program compiling, linking, and any errors if the code is incorrect. If the program is correct, you can go ahead to run a program. If there are errors in the program, you must debug (fix) the code and try building the program again. If you receive the message: There were build errors. Continue?, always select the No button. You must keep debugging and building the program until it is correct. EVERY TIME YOUR RUN YOUR PROGRAM, IT IS AUTOMATICALLY SAVED TO THE LOCATION: C:\temp\lab1in
If you have no syntax errors the following messages (indicating Success) will be displayed:
Suppose you did not enter your program correctly (i.e., you have syntax errors). An example of this program (lab1inp1) containing syntax errors is shown below: The above program is missing a ; on the last statement. Double click on the error and the general region of where the error occurs is highlighted in blue. Note the error messages provided. You must correct all errors before you can build your program successfully.
Running your Program To run your program (without debugging) use Debug->Start without Debugging as shown below: The following window will be displayed when running your program:
Work on another program When you are done with one program and want to write another program, close the visual studio.net 2008. And repeat the above procedure by using different project name and C++ file name. These names are given by you and should be meaningful. For example, project name for the 2 nd program can be lab1in2, and its C++ source code file s name can be lab1inp2.cpp. Opening an Existing Project 1) To open a project you have already created, select File from the menu bar, then Open, and then Project. 2) Find your existing project in the temp folder. Double click on the yellow folder to open it. 3) Double click on the desired project name with the.sln file extension. 4) In the Solution Explorer window, double click on your.cpp file. Your source code should appear in the editing window. 5) NOTE: A.cpp file will not run unless it is opened in a Project. You must add your.cpp file to a project or copy and paste your source code into a project.
Submitting work via Blackboard When you are finished with the assignments, then you must submit your files via Blackboard. This is the only method in which your lab assignments will be accepted. They must be submitted on time. If you miss the deadline, your option to submit your work is gone. DO NOT WAIT UNTIL THE LAST MINUTE TO SUBMIT. You must submit all files at the same time. Blackboard only allows one submission per assignment, so all files must be submitted at the same time. 1) In the current lab assignment in Blackboard, scroll to 2. Assignment Submission. 2) Select Browse My Computer. Find all of your.cpp assignment files on the storage device you saved it on. (They should be in the temp folder on the C drive and then in the folder that you named your project. Two folders you used: lab1in1 and lab1in2 Make sure you only select the.cpp files). Select all files to be submitted (lab1inp2.cpp and lab1inp2.cpp). 3) When finished uploading all files to be submitted, select Submit. 4) It is highly advised to backup all of your work. You can copy these files from the temp folder on the C drive to some storage media using Windows Explorer. If you do not know how to do this, ask the lab assistant or me for help. 5) Always delete your files off of the computer you were using. All parties turning in duplicated code will be dismissed from the course and receive an F. (See syllabus.) You can delete your files (in the temp folder on the C drive) using Windows Explorer. Always log off the computer you were using so no one else has access to your account.