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

Sample Programming Lab Report (1)

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

Sample Programming Lab Report (1)

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

ME-101L Sample Lab

Report

Department of Mechanical Engineering


University of Engineering & Technology
Main Campus, Peshawar

LAB Report # 1

ME-101L Lab Report Submitted By:

Name: MUHAMMAD UMER RASHID

Registration No: 06436, Class no: 3


Section: A

Submitted To:

Dr. Fakhre Alam Khan

Lab Date: Marks & Signature

Submission Date:
Objective(s):
 To be familiar with syntax and structure of C++ programming.
 To learn problem solving techniques using C++
Title No 1:
Define your first and last names initials as two different variables print your name initials as
combination of two individual variables. Also write algorithum, flow chart and codes.
Algorithm:
1. Start.
2. Declare variable for the first name variable first name_M.
3. Declare variable for the last name variable last name_D.
4. Combination of name initials.
5. Display name.
6. End
Flowchart:
Start

First_name

Last_name

Combination of name initials

Display combination

End
Code:
#include<iostream>
Using namespace std;
Int main()
{
Char first vaiable =’M’;
Char last variable=’D’;
Cout<<”my initials are:”<<firstname<<lastname<<endl;
Return 0;

Discussion and Conclusion


My initials are MD.

IN THIS PROCESS WE CAME TO KNOW ABOUT ALGORITHUM, FLOWCHART AND


CODING.

Title No 2:
Write a program to take in the age of user and display the output on screen.

Algorithm:
1. Start

2. Declare a variable ‘age’ to store the user age.

3. Print the message “Enter Your Age” to the screen.

4. Read the input from the user and store it in the variable ‘age’

5. Print the message “You Are” followed by the value of ‘Age’ to the screen and at the last
“Years old”.

6. End
Flowchart:
Start

Declare variable ‘age’

Enter your age

Read input from user

Display age

End
Code:
#include <iostream>
Using namespace std;
Int main()
{
Int age ;
Cout<< “Enter your age:18”;
Cin>>age;
Cout<< “you are” << age << “years old.”<<”\n”;
Return 0;
}

Discussion and Conclusion/output:


Enter your age:18.
Title No 3:
Write down a C++ program to convert temperature from Celsius to fahrenhiet.
Algorithm:
1. Start.
2. Declare variables ‘celsius’ and ‘Fahrenheit’ to store the temperature.
3. Print the message ‘enter temperature in celsius’ to the screen.
4. Read the input from the user and store it in the variable ‘celsius’.
5. Convert the temperature from Celsius into fahrenhiet using formula.
6. Print the message showing temperature in fahrenhiet.
7. End.
Flowchart:
1 Start

Declare variable ‘celsius’ and ‘fahrenhiet’

Enter temperature in
celsius

F=(Celsius*9/5)+32

Display result

End

Code:
#include <iostream>
using namespace std;
int main()
{
float celsius,fahrenheit;
cout << "enter temperature in celsius:";
cin>>celsius;
fahrenheit=(celsius *9.0/5.0)+32;
cout<<celsius<<"degree celsius is equal to"<<fahrenheit<<"degree fahrenhiet."<<"\n";
return 0;
}

Discussion and Conclusion/output:


Enter temperature in Celsius:

You might also like