- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Program for Volume and Surface Area of Cuboid in C++

## What is cuboid?

Cuboid is a three-dimensional object with six faces of rectangle shape which means it has sides of different length and breadth. The difference between a cube and cuboid is that a cube has equal length, height and breadth whereas in cuboids these three are not same

Properties of cuboid are −

- six faces
- 12 edges
- 8 vertices

Given below is the figure of cube

## Problem

Given with the length, width and volume, the task is to find the total surface area and volume of a cuboid where surface area is the space occupied by the faces and volume is the space that a shape can contain.

To calculate surface area and volume of a cuboid there is a formula

Surface Area = 2(|*w + w * h + |*h )

Volume = L* W * H

## Example

Input-: L=3 H=2 W=3 Output-: Volume of cuboid is: 18 Total Surface Area of cuboid is: 42

## Algorithm

Start Step 1 -> declare function to find volume of cuboid double volume(double l, double h, double w) return (l*h*w) Step 2 -> declare function to find area of cuboid double surface_area(double l, double h, double w) return (2 * l * w + 2 * w * h + 2 * l * h) Step 3 -> In main() Declare variable double l=3, h=2 and w=3 Print volume(l,h,w) Print surface_area(l, h ,w) Stop

## Example

#include <bits/stdc++.h> using namespace std; //function for volume of cuboid double volume(double l, double h, double w){ return (l * h * w); } //function for total surface area of cuboid double surface_area(double l, double h, double w){ return (2 * l * w + 2 * w * h + 2 * l * h); } int main(){ double l = 3; double h = 2; double w = 3; cout << "Volume of cuboid is: " <<volume(l, h, w) << endl; cout << "Total Surface Area of cuboid is: "<< surface_area(l, h, w); return 0; }

## Output

Volume of cuboid is: 18 Total Surface Area of cuboid is: 42

- Related Questions & Answers
- Java Program to Find the Surface area and Volume of Cuboid
- Program for Volume and Surface Area of Cube in C++
- Program for Volume and Surface area of Frustum of Cone in C++
- Surface Area and Volume of Hexagonal Prism in C programming
- Program for Surface area of Dodecahedron in C++
- Program for Surface Area of Octahedron in C++
- How to find Volume and Surface Area of a Sphere using C#?
- Find maximum volume of a cuboid from the given perimeter and area in C++
- Program to calculate area and volume of a Tetrahedron
- Program to find the Area and Volume of Icosahedron in C++
- Maximize volume of cuboid with given sum of sides in C++
- Surface Area of 3D Shapes in Python
- Program for volume of Pyramid in C++
- C Program for Area And Perimeter Of Rectangle
- Find the Surface area of a 3D figure in Python

Advertisements