Docsity

Lab Manual for Computer Programming I - University of Engineering and Technology, Lahore, Study Guides, Projects, Research of Computer Programming

Partial preview of the text

Download Lab Manual for Computer Programming I - University of Engineering and Technology, Lahore and more Study Guides, Projects, Research Computer Programming in PDF only on Docsity!

Computer Programming I

A

(MCT-242L)

Lab Manual

Group Members

Unnsa Nazir 2020-MC-

Amna ali 2020-MC-

Teacher

Mr. Mohsin Sheraz

Department of Mechatronics & Control Engineering,

(Session 2020)

UNIVERSITY OF ENGINEERING AND

TECHNOLOGY, LAHORE (FSD CAMPUS)

Lab NO.

Objective:

About the basic theory, background of the contents, keywords, tools, functions etc. To perform simple task expressing some key functions and syntax usage. To write the table of “2” and show is as Output in Command Prompt console.

Theory:

C++ Development C++ is a general-purpose programming language and widely used nowadays for competitive programming. It has imperative, object- oriented and generic programming features. Personal development environment on your local machine you need to install two important software’s:

1. Text Editor: Text Editors are type of programs used to edit or write texts. We will use text-editors to type our C++ programs. The normal extension of a text file is (.txt) but a text file containing C++ program should be saved with ‘.CPP’ or ‘.C’ extension. Files ending with the extension ‘. 2. C++ Compiler: Once you have installed text-editor and typed and save your program in a file with ‘. CPP ’ extension, you will need a C++ compiler to compile this file. A compiler is a computer program which converts high-level language into machine understandable low-level language. 3. #include: In C++, all lines that start with pound (#) sign are called directives and are processed by preprocessor which is a program invoked by the compiler. The #include directive tells the compiler to include a file and #include. 4. iostream: iostream stands for standard input-output stream. This header file contains definitions of objects like cin, cout, etc. 5. using namespace std: This is used to import the entirety of the std namespace into the current namespace of the program int main(): This line is used to declare a function named “ main ” which returns data of integer type. A function is a group of statements that are designed to perform a specific task. Execution of every C++ program begins with the main() function, no matter where the function is located in the program. So, every C++ program must have a main() function. 6. { and }: The opening braces ‘{‘ indicates the beginning of the main function and the closing braces ‘ } ’ indicates the ending of the

Input and Output:

Task 3:

In this task we write some line but in the end of every line use “endl” then output displayed the every separate line

Input:

Output:

Input and Output:

Output:

Conclusion:

We have performed our all task carefully and successfully with the required task gave us by instructor.

Lab NO.

Objectives:

Task 1: What is chaining?

Chaining:

Now that we have outputted a variable and have also outputted things using multiple cout. Let’s take a closer look at cout again.

Input:

Output:

We print this with in a single line with the use of multiple operations like this Input and Output:

Output:

Conclusion:

We have performed all the task carefully and also a successfully.