Me 101 Lab Reprot 2
Me 101 Lab Reprot 2
Me 101 Lab Reprot 2
LAB REPORT #2
Submitted by;
Name : Musaddiq Ahmad
Section : A
Class no: 20
Submitted to;
Dr Fakhar Alam
15-10-2019
Objectives:
Title:
Problem 1:
Write down the C++ program to show the following Text on Screen.
My name is_________________.
My registration number is___________.
I am currently enrolled in 1st semester Mechanical Engineering Department and this is my first C++ coding
program.
Problem analysis:
The problem is to code such a program in which the name of operator, His/her registration number and department in
which he/she is enrolled will be given as output stream and all these information’s will be print out in console. But it is
only possible when there is no error in the program.
Algorithm:
1. Start program.
2. Print the name, registration and department of operator.
3. End program.
Flow chart:
Start
End
Problem 2:
Write down your first and last name as two different variables, and then print your full name together.
Problem Analysis:
The problem is to use my first and last name as two different variables.I denote my first name as first and the
last name as last . As name contains a lot of letters so I will save the name in string variable which is a type of local
variables. In order to print my name I will use the cout statement.
Algorithm:
1. Start program.
2. Define variables as: Variable1=Musaddiq variable2=Ahmad
3. Write “My name is ” in cout and follow the statement with variable1 and variable2 .
4. Print the cout statement.
5. End program.
Flow chart:
Start
Variale1=Musaddiq
Variable2=Ahmad
My name is
Musaddiq
AhmadAhmad
End
Define your name, registration no, home address and contact no as different variables types, print your full data
as combination of all these individual variables.
Problem analysis:
The problem is to use my name, registration no , home address and contact no as different variables
types.And then to print them. I will use my name,contact no and address as string variable because the string variable
allow us to use lot of letters .I will use my registration no. as int variable. Finally to print my data I will use cout.
Algorithm:
1. Start the program.
Flow chart:
Start
End
Figure 2 prepared in code block C++ compiler
**