Found 7347 Articles for C++

Program for Volume and Surface area of Frustum of Cone in C++

Sunidhi Bansal
Updated on 20-Sep-2019 14:21:20

414 Views

What is Frustrum of cone?Frustum of a cone is formed by cutting the tip of a cone leaving lower and upper base known as frustum as shown in the figure. The upper base of frustum will have radius ‘r’, lower base will have radius ‘R’ with height ‘h’ and slant height ‘L’Given below is the figure of Frustrum of coneProblemGiven with slant height, height, upper base radius ‘r’ and lower radius ‘R’, the task is to calculate the volume and surface area of Frustum of cone.To calculate the volume and surface area of Frustum of cone there is a formulaVolume ... Read More

Program to calculate the area between two Concentric Circles in C++?

Sunidhi Bansal
Updated on 20-Sep-2019 14:16:10

353 Views

What is Concentric Circle?Concentric circle is the circle inside the circle which means they share common center with different radius lengths i.e. r1 and r2 where, r2>r1. Region between two concentric circles is known as annulus.Given below is the figure of Concentric CircleProblemGiven with two concentric circles of different radius lengths r1 and r2 where r2>r1. The task is to find the area between both the circles which is highlighted by the blue colour.To calculate area between two circles we can subtract the area of larger circle from smaller circleLets say, bigger circle have radius r2 and smaller circle have ... Read More

Program to calculate area of Circumcircle of an Equilateral Triangle in C++

Sunidhi Bansal
Updated on 20-Sep-2019 13:56:40

158 Views

As the name suggests, equilateral triangle is the one that have equal sides and also it have equal interior angles of 60° each. It is also known as regular triangle because it’s a regular polygonProperties of equilateral triangle are3 sides of equal lengthInterior angles of same degree which is 60Circumcircle of a plygon is the circle that passes through all the vertices of a polygon. The radius of circle can be an edge or side of polygon inside the circle which is known as circumradius and center of circle is known as circumcenter. It can be inside or outside of ... Read More

Program to calculate area and perimeter of equilateral triangle in C++

Sunidhi Bansal
Updated on 20-Sep-2019 13:49:21

281 Views

What is Equilateral Triangle?As the name suggests, equilateral triangle is the one that have equal sides and also it have equal interior angles of 60° each. It is also known as regular triangle because it’s a regularpolygonProperties of equilateral triangle are −3 sides of equal lengthInterior angles of same degree which is 60Given below is the figure of equilateral triangleProblemGiven with the side of equilateral triangle the task is to find the area and perimeter of a triangle where area is the space occupied by the shape and perimeter is the space occupied by its boundaries.To calculate area and perimeter ... Read More

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

Sunidhi Bansal
Updated on 20-Sep-2019 12:36:32

594 Views

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 sameProperties of cuboid are −six faces12 edges8 verticesGiven below is the figure of cubeProblemGiven 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 ... Read More

Program for Volume and Surface Area of Cube in C++

Sunidhi Bansal
Updated on 20-Sep-2019 12:08:08

688 Views

What is cube?Cube is a three-dimensional object with six faces of square shape which means it has sides of same length and breadth. Cube is the only regular hexahedron with following properties −six faces12 edges8 verticesGiven below is the figure of cubeProblemGiven with the side, the task is to find the total surface area and volume of a cube 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 cube there is a formula −Surface Area = 6*Side*sideVolume = Side*side*sideExampleInput-: side=3 Output-: volume ... Read More

Program for Surface Area of Octahedron in C++

Sunidhi Bansal
Updated on 20-Sep-2019 12:02:36

135 Views

What is Octahedron?The word ‘dodecahedron’ is derived from the Greek words where, Octa means ‘Eight’ and hedron specifies ‘faces’. octahedron in geometric is a 3-D platonic or regular solid with eight faces. Like, other figures octahedrons also have properties and that are −6 polyhedron vertices12 polyhedron edges8 equilateral facesGiven below is the figure of octahedronProblemGiven with the sides, the program must find the surface area of octahedron where surface area is the total space occupied by the faces of the given figure.To calculate surface area of octahedron there is a formula −Where, a is side of an OctahedronExampleInput-: side=5 Output-: ... Read More

Program for Surface area of Dodecahedron in C++

Sunidhi Bansal
Updated on 20-Sep-2019 11:58:55

152 Views

What is Dodecahedron?The word ‘dodecahedron’ is derived from the Greek words where, dodeca means ‘twelve’ and hedron specifies ‘faces’. Dodecahedron in geometric is a 3-D platonic or regular solid with twelve flat faces. Like, other figures dodecahedron also have properties and those are −20 polyhedron vertices30 polyhedron edges12 pentagonal faces, as a pentagon is a five-sided polygonGiven below is the figure of dodecahedronProblemGiven with an edge, the program must find the surface area of dodecahedron where surface area is the total space occupied by the faces of the given figure.To calculate surface area of dodecahedron there is a formula −ExampleInput-: ... Read More

Program for Celsius To Fahrenheit conversion in C++

Sunidhi Bansal
Updated on 20-Sep-2019 08:30:20

616 Views

Given with temperature ‘n’ in Celsius the challenge is to convert the given temperature to Fahrenheit and display it.ExampleInput 1-: 100.00    Output -: 212.00 Input 2-: -40    Output-: -40For converting the temperature from Celsius to Fahrenheit there is a formula which is given belowT(°F) = T(°C) × 9/5 + 32Where, T(°C) is temperature in Celsius and T(°F) is temperature in FahrenheitApproach used below is as followsInput temperature in a float variable let’s say CelsiusApply the formula to convert the temperature into FahrenheitPrint FahrenheitALGORITHMStart Step 1 -> Declare a function to convert Celsius to Fahrenheit    void cal(float cel) ... Read More

C++ Interview questions based on constructors/ Destructors

sudhir sharma
Updated on 19-Sep-2019 10:36:22

908 Views

C++ interview questions on ConstructorsWhat is a constructor?A constructor is a function of a class that has the same name as the class. The constructor is called at the time of the initialization of object. There are three types of constructors −Default constructorParameterized constructorCopy constructorSyntaxclass cl_name{    cl_name(){       //This is constructor..    } }What is a destructor?A destructor is a method of a class that has the same name as the class preceded by a tild ~ symbol. It is called at the end of code or when the object is destroyed or goes out of scope.Syntaxclass ... Read More

Advertisements