The clearfix, as the name suggests, is used to clear floats. It is generally used in float layouts. The clearfix is considered a hack to clear floats. Overflow Issue Example Let us see the problem first before moving towards the solution. We have an image here, floated to the right. It overflows outside its container since it is way taller than the element belonging to it − DOCTYPE html> div { border: 2px solid blue; ... Read More
We can easily center text inside a div both horizontally and vertically. Let us see them one by one. Center Text in Div Horizontally using the text-align property To center text in div horizontally, use the text-align property. The text-align property determines the way in which line boxes are aligned within a block-level element. Here are the possible values − left − The left edge of each line box is aligned with the left edge of the block-level element's content area. right − The right edge of each line box is aligned with the right edge of the block-level ... Read More
To remove extra space below the image inside div, we can use CSS. The following CSS properties can be used to get rid of the space − The vertical-align property The line-height property The display property Before moving further, let us see how the extra space below an image looks like − The image in a div can have an extra space below. It looks annoying and should be removed as shown below. We have marked the space as extra space below − Let us now see the fix − Clear the extra space below an image ... Read More
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
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
Cosine is a trigonometric term that deals with right-angled triangle. When an acute angle is thought of as being a member of a right triangle, the cosine trigonometric function measures the distance between the angle's neighbouring leg and the hypotenuse. We require the angle between the hypotenuse and the adjacent edge in order to calculate cosine. Let the angle is 𝜃. The cos$(\theta)$ is like below $$\mathrm{cos(\theta)\:=\:\frac{adjacent}{hypotenuse}}$$ In this article, we shall discuss the techniques to get the value of cos$(\theta)$ in C++ when the angle is given in the radian unit. The cos() function To compute the cos$(\theta)$ The ... Read More
Sine is a trigonometric parameter that deals with the right-angled triangle. The sine is the ratio of the opposite side to the hypotenuse. While calculating sine, we need the angle between the hypotenuse and the opposite side. Let the angle is 𝜃. The sin(𝜃) is like below − $$\mathrm{sin(\theta)\:=\:\frac{opposite}{hypotenuse}}$$ In this article, we shall discuss the techniques to get the value of sin(𝜃) in C++ when the angle is given in the radian unit. The sin() function To compute the sin(𝜃) we need to use the sin() method from the cmath library. This function takes the angle in radian and ... Read More
In different applications calculating logarithms for base 2 is somewhat necessary. There are a few shortcut methods to remember a few log values for competitive exams. While using programming, we have a handful of options to calculate logarithm results from library functions and also some tricks to compute them. In this article, we shall discuss a few techniques to compute logarithm base 2 for a given number in C++. Using log2() function The log2() is one library function that is used to calculate the logarithm base 2 for a given parameter. The answer may be an integer or floating point ... Read More
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
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