1

Ceng198

Introduction to Computer Programming

Lab#0

Introduction to Microsoft Visual Studio 6.0


During this semester and the rest of your university years, as future computer engineers you will be using MS Visual Studio, for programming in C/C++. So learn it as good as possible. You will be kept responsible for every detail of the program so try everything that is necessary and not necessary as well, don’t forget it is just software and it won’t bite


The following is just a brief introduction on how to open a file and start your first program in visual studio.


You will be seeing this screen when you start the program. Just press “Close” to close the “Tip of the Day” window.




- Figure 1. -





In order to open your new file, click on the “File” menu on top of the toolbar, then click “New”. The following window will appear;




- Figure 2. -



From this window you can choose from a couple of options from the tabs at the top of the window. Select the “Projects” tab. Then, select the “Win32 Console Application” from the types of projects. On the upper right of the window there is a text box where you can enter your project name.


Do not forget to select the location of your project, it is best to save it on “Desktop” that way you can easily find it when you are done. You can browse to find the location you want to save it in by clicking the button right next to the text box under “Location”.


After you have done these click the “OK” button to continue. You will see the following window;



- Figure 3. -


In this window you must make sure that the “An empty project” radio button is selected. If it is not then just select it and continue on by clicking the “Finish” button.


After you have clicked the “Finish” button you will see the following window (“New Project Information”). Just click the “OK” button to continue.


In the end you will end up with a blank project shown in Figure 5.


To view the files and folders inside your project you can select the “File View” tab located at the bottom of your workspace window.


The workspace window is the one on the left. The window below is your output window. It shows you the number of errors and warnings there are in your program after you have compiled it.


- Figure 4.-



- Figure 5.-




Now to add a file to your blank project you must click the “File” menu above the toolbar and select “New” again. This time you will select the “Files” tab if it is not already selected, and then select the “C++ Source File” file type. Do not forget to type in the file name.


The file will be automatically inserted and saved into your project so you do not need to browse for a location.

The following figure shows the “New” window.



- Figure 6 -


After you have selected your file type and entered your file name, click the “OK” button to continue.


Now you have a blank file in your project where you can start typing in your program.










The following figure is what you should be looking at after you have completed all of the above instructions;



- Figure 7.-




The default file extension is “.cpp”. You do not have to enter a file extension when typing in the name of your file. The extension comes with the file type you select in the “Files” tab of the “New” window.


This semester you will be choosing the “C++ Source File” file type for all of your projects, the others will be taught in the year to come. Though feel free to open up different kinds of file types to see what they are.










Your first program should look like the following;



- Figure 8.-


On the right side of the toolbar there are 3 buttons which you will be using to compile, build and run or execute your program (the red exclamation mark).


Compile” is the first button and the second one is “Build”.


Now that you have typed in your first program just run the program and see what comes out on the system screen. Don’t forget to check the output window as well. If you have zero errors and zero warnings then that means your program works just fine, but if you do have errors well you will just have to scroll up on the output window and check where the error is at.


To see where the error is at you have to double click on the error, and a blue arrow will appear on the window where your program is typed.



Part 1. Do It Yourself.

Write a complete C program to produce (exactly) the following output:

Program Output:

Enter your grades:

Midterm:

Final:

Quiz:

Attendance:

LabGrades:

Your weighted-avarage is ....... with 20% of midterm, 40% of final,15% of Quizes, 10% of attendence and 15% of LabGrades.