0% found this document useful (0 votes)
13 views

Lab Report 1

1. The document provides instructions for setting up a C++ programming project in Visual Studio and writing simple programs. 2. It guides the reader through creating a project, adding source code files, compiling, running and debugging programs, and reviewing the Visual Studio interface. 3. The tasks also cover adding an existing source file to a project, resolving errors from multiple main functions, and examples of compiler error messages.

Uploaded by

anasrehmannust
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Lab Report 1

1. The document provides instructions for setting up a C++ programming project in Visual Studio and writing simple programs. 2. It guides the reader through creating a project, adding source code files, compiling, running and debugging programs, and reviewing the Visual Studio interface. 3. The tasks also cover adding an existing source file to a project, resolving errors from multiple main functions, and examples of compiler error messages.

Uploaded by

anasrehmannust
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Cs110: fundamental of computer programming

Lab No-01

Class: BESE-14A

NAME REG N0 / QALAM ID #

ANAS REHMAN 464092

SUBMITTED BY:

SUBMITTED TO: Ms. Shakeela Bibi

Date Issued: 19th September 2023

Due Date: 26th September 2023


Lab 01: introduction to c++ programming

Task #1: Creating a Project in Visual Studio (to compile and run programs)

1. Click File in the top menu bar of Visual Studio, and then select the New... option, and select
project.

2. This will bring up a dialog box that contains many project possibilities.
Click on "Win32" under Visual C++ in the left pane of the window.

3. Select "Win32 Console Application" from the right pane of the window.

4. Enter a name for the project in the lower part of the window: Lab00
5. Now enter the name for the solution: CS110Labs. Press OK to create the solution and the
project.
6. A Win32 Application Wizard window will appear . Select "Application Settings" on the left
side of this window.

7. Under additional options, check the "Empty Project" box. Select Finish.
Task #2: Add some source code to this project

1. Right click the project Lab00 in Solution Explorer, and then select the Add > New Item
option

2. You should see a window with Installed Templates. Select Visual C++ > C++ File (.cpp).
3. Enter MyFirstProgram_v1.cpp in Name textbox. Press Add button

4. Write some code in the source file MyFirstProgram_v1.cpp


5. To compile, select the Build menu in the top menu bar. Select the option Build Lab00.

6. A lower window will show the results of this process. (As it is, MyFirstProgram_v1.cpp file
will compile successfully.) You will see an output like this. You should have 0 error(s).
7. To run (execute), select the Debug menu in the top menu bar. Select the option Start Without
Debugging.

8. A black ’DOS-type’ window will appear showing the output of your program.
To edit the source code (modify the program):

9. Modify the "Welcome to CS110!!" data to read something a little different, say "Greetings
human! Welcome to CS110!!"

10. To recompile, select the Build menu in the top menu bar. Select the option Rebuild Lab00.
11. A lower window will show the results of this process.

You wish to rerun the executable file created in the compilation process:

12. To run (execute), select the Debug menu in the top menu bar. Select the option Start Without
Debugging.
13. A black ’DOS-type’ window appears showing the new output of your program.
Task #3: Reviewing the Visual Studio Environment.

1. Write a program MyFirstProgram_v2 which outputs on notepad.

2. Save the file named in the same directory as MyFirstProgram_v2.cpp.


3. Click Project in the top menu bar of Visual Studio, and then select the Add Existing Item
option.

4. Since we have already copied the files to the right place you will see the icon of the file you
need to add. Select MyFirstProgram_v2.cpp. If you wish, by selecting the arrow beside the Look
in address box, you can navigate to the folder in which you saved the MyFirstProgram_v2.cpp
file. To see the C++ files in this folder, set the Files of type (see bottom box of Look in menu)
box to contain Visual C++ Files (which may already be the default value).
5. You should now see the name of this file (MyFirstProgram_v2.cpp) displayed under the folder
Source Files in the upper left panel.

6. Compile the program and execute it.


If you get an error saying you have more than one source file containing a
main function. Remove all except the one you want. Here, we need to remove
MyFirstProgram_v1.cpp.

1. Right click on the MyFirstProgram_v1.cpp and select remove. Removing does not mean
that you are deleting the file. The file is just removed from the project.

2. Compile the program and execute it.


Task #4:

If you modify a file with a deliberate error, you can see what sort of message this error
generates when you try to recompile.

You might also like