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:
Registration No:
Section:
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:
Write a Program to calculate
Problem Analysis:
Input Processing Output Necessary header
variables variables/calculations variables files/functions/macros
(int) iostream
(int) (int)
(int)
Algorithm:
1. Start
2. Define variables: h(int), w(int), d(int), vol(int)
3. Assign value to variables: h = 10, w=12, d=8
4. Calculate the volume as: vol = h*w*d
5. Dishhhhhhplay the volume (vol)
6. Stop
Flowchart:
Code:
//Following code is written and compiled in Visual
Studio 2022.
#include<iostream>
using namespace std;
int main()
{
//start the program
int h, w, d, vol;
//variables declaration
h = 10;w = 12;d = 8;
//assign value to variables
vol = h * w * d;
//calculation using mathematical formula
cout << "The Volume of the cube is: " << vol;
//display the volume
system("pause>0");
//hold the screen until a key is pressed.
}
Output (Compilation, Debugging & Testing)
The Volume of the cube is: 960
Discussion and Conclusion
This is the first code written in C++ program. The program is focused on the calculation of
volume of a cube for the given height, width and depth. From this lab, I understood the basic
structure of C++ programming including the meaning of header files & steps of problem
solving. Hence, volume of a cube is calculated and displayed.