C++ Articles

Page 448 of 597

C++ Program to find the hyperbolic sine of given radian value

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Oct-2022 386 Views

Normal trigonometric functions have analogous to hyperbolic functions, which are defined using the hyperbola rather than the circle. In hyperbolic geometry, hyperbolic functions are used to calculate angles and distances. Additionally, they appear in the answers to a lot of linear differential equations, cubic equations, etc. For given angle$\theta$. The hyperbolic sine function sinh$(\theta)$ is like below. $$\mathrm{sinh(x)\:=\:\frac{e^x\:-\:e^{-x}}{2}\:=\:\frac{e^{2x}-1}{2e^x}\:=\:\frac{1-e^{-2x}}{2e^-x}}$$ In this article, we shall discuss the techniques to get the value of sinh$(\theta)$ in C++ when the angle is given in the radian unit. The sinh() function To compute the sinh$(\theta)$ The sinh() function from the cmath package will be used. ...

Read More

C++ Program to find the tangent of given radian value

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Oct-2022 632 Views

The right-angled triangle is the subject of the trigonometry concept known as the Tangent. The ratio between the angle's opposing leg and its adjacent leg when it is thought of as a right triangle is the trigonometric function for an acute angle. To calculate the tangent, we need to know the angle between the hypotenuse and the adjacent edge. Let the angle is 𝜃. The tan$(\theta𝜃)$ is like below: $$\mathrm{tan(\theta)\:=\:\frac{opposite}{adjacent}}$$ In this article, we shall discuss the techniques to get the value of tan$(\theta𝜃)$ in C++ when the angle is given in the radian unit. The tan() function To compute ...

Read More

C++ Program to calculate the cube root of the given number

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Oct-2022 5K+ Views

Multiplying the same number thrice is termed as the cube of that number. Or we can say the number raised to power 3. For instance 3 * 3 * 3 = 27, which is a cubic number. But if we want to perform the reverse operation, we need to find the cube root of the number. For example $\sqrt[3]{27}$ = 3. In this article, we shall discuss how to calculate the cube root of a given number in C++. There are a few different techniques to do so. Using cbrt() function The cbrt() is one library function that is used ...

Read More

C++ Program to read the height of a person and the print person is taller, dwarf, or average height person

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Oct-2022 1K+ Views

A person’s height determines whether he/ she is tall, dwarf, or average height person. In different regions of the world, the height ranges are different. We are considering Indian standards. In this article, we shall cover how to write a simple program to determine whether a person is taller, dwarf, or of average height person in C++. Let us define the height range and corresponding classification first, then we can use them in the algorithm as well as in our implementation. Height (cm) Type 150 – 170 Average 170 – 195 Tall Below ...

Read More

C++ Program to calculate the volume and area of Sphere

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Oct-2022 9K+ Views

The Sphere is a ball-like 3D object whose all sides are curved surfaces. On a sphere, no plane surface is there. The volume of a sphere is actually how much space it is taking in the space. In this article, we shall cover the techniques to calculate the volume and the surface area of a sphere in C++. A sphere has one basic parameter. The radius 𝑟. We will see the techniques to calculate the volume and area one by one. The volume of a Sphere To calculate the volume of a sphere, we need one input, the radius 𝑟. ...

Read More

C++ Program to calculate the volume and area of the Cylinder

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Oct-2022 9K+ Views

The cylinder is a tube-like 3D object whose base is a circle and has a certain height. The volume of a cylinder is actually how much space it is taking in the space. In this article, we shall cover a few techniques to calculate the volume and the surface area of a cylinder in C++. A cylinder has two basic parameters. The height ℎ and the radius of its bases 𝑟. The surface area of a cylinder can have two variations. Only the outer curved surface (for hollow and both side open cylinder) and area with the curved surface with ...

Read More

C++ Program to calculate the sum of all odd numbers up to N

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Oct-2022 14K+ Views

Getting series sum is one of the simplest practicing tasks while we are learning programming and logic build up. In mathematics, there are certain ways to find sum of series present in different progressions. In programming, we generate them one by one by implementing the logics, and repeatedly add them to get the sum otherwise perform any other operation if needed. In this article we shall cover techniques to get sum of all odd numbers up to N using C++. There are two possible ways to get this sum with a little variation. Let us see these approaches one by ...

Read More

C++ Program to Round a Number to n Decimal Places

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Oct-2022 26K+ Views

Representing numbers in outputs is an interesting and also important task while we are writing programs in any language. For integer type (short, long, or medium) type data, it is easy to express the numbers as output. For floating point numbers (float or double type), sometimes we need to round them off to certain decimal places. For example, if we want to represent 52.24568 up to three decimal places, some pre-processing needs to be done. In this article, we shall cover a few techniques to represent a floating-point number up to a certain decimal placed by rounding it off. Among ...

Read More

C++ Program to Calculate simple interest and compound interest

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Oct-2022 27K+ Views

After calculating interest on the principal amount, simple interest is calculated by taking the principal amount, the rate of interest, and the number of years it will take to calculate interest. The formula is quite easy to understand. The power law is used to calculate compound interest by taking into account the principal amount, the rate of interest, and the period. Here, the formula is likewise not difficult. In this article, we'll talk about how to calculate simple and compound interest values and then use the C++ programming language to put this logic into practice. Simple Interest Simple interest is ...

Read More

C++ program to Reorder the Given String to Form a K-Concatenated String

Prateek Jangid
Prateek Jangid
Updated on 10-Aug-2022 204 Views

We are given a string and an integer k, and we need to reorder the characters in the string so that it becomes the concatenation of k similar substring. If not possible, output the result as "Impossible”. string = "malaalam"; K = 2; res = solve(s, K); Example (Using Maps) Let's have a string "mottom" and K=2. The given string can be represented as the concatenation of 2 substrings like tomtom, motmot omtomt, etc. As in all 3, two substrings are joined together when k = 2. Using the string, we can determine how many times each character occurs. ...

Read More
Showing 4471–4480 of 5,962 articles
« Prev 1 446 447 448 449 450 597 Next »
Advertisements