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

Sample Programming Lab Report

Uploaded by

alihamza3661213
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views

Sample Programming Lab Report

Uploaded by

alihamza3661213
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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 and display the volume of a CUBE having its height (h=10cm),
width (w=12cm) and depth (8cm).
Problem Analysis:
The problem is to calculate the volume of a CUBE having its inputs parameters identified
as:Height (integer type), width (integer type) and depth (integer type). The output of the
program is to display the volume; hence the output parameter is identified as vol (integer type).
During the processing or calculation phase, we don’t need any extra parameters (variables) for
this problem.
The volume of the cube is the multiplication of its height, width and depth, hence the
mathematical formula to calculate volume is:
vol = height* width* depth. (vol = h*w*d)

Input Processing Output Necessary header


variables variables/calculations variables files/functions/macros
h(int) vol = h*w*d vol iostream
w(int) (int)
d(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. Display the volume (vol)
6. Stop
Flowchart:
Code:
Start
//Following code is written and compiled in Visual
Studio 2022.
#include<iostream>
[le fin e h,IV,d, VO I
using namespace std;
int main()
{
//start the program
h=lO; w =12; d1=8; int h, w, d, vol;
vol=h • w • d //variables declaration
h = 10;w = 12;d = 8;
//assign value to variables
vol = h * w * d;
//calculation using mathematical formula
Print vol
cout << "The Volume of the cube is: " << vol;
//display the volume
system("pause>0");
//hold the screen until a key is pressed.
END
}
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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy