
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Found 7333 Articles for C++

513 Views
Rotating an array means shifting its elements in a specific direction while maintaining their relative order. In this article, we will rotate an array right by one position using C++. For example, if the array is {4, 8, 15, 16, 23}, rotating it right once will result in {23, 4, 8, 15, 16}. We are given an array and need to shift all elements one step to the right, with the last element moving to the first position. Example 1 Input:array = {10, 20, 30, 40, 50} Output:array = {50, 10, ... Read More

1K+ Views
A square is a four-sided polygon with all sides equal and all angles equal to 90 degrees. In computational geometry, determining whether four given points form a square is a common problem. In this article, we will discuss multiple approaches to check whether four given points in a 2D plane form a square using C++. When can a four-sided polygon be called a Square? If we are given four points, we have to determine whether it is a square or not. To determine if four points (A, B, C, D) form a square, the given conditions below must be satisfied: ... Read More

1K+ Views
The area of a circle is a fundamental mathematical concept that can be easily calculated using a simple formula. In C++, there are multiple ways to find the area of a circle. In this article, we are going to discuss various approaches to calculating the area of a circle in C++. How to Find the Area of a Circle? The formula for finding the area of a circle with a given radius r is: Area = π × r × r Example 1 Input: r = 5 Output: 78.54 Explanation: ... Read More

3K+ Views
In this problem, we are given an array of integers, and our task is to calculate the absolute sum of its elements. The absolute sum means the sum of the absolute values of all the array elements. In this article, we are going to learn how to compute the absolute sum of an array's elements using C++. Example 1 Input: arr = {-3, 2, -7, 4} Output: 16 Explanation: The absolute values of the array elements are: | -3 | = 3, | 2 | = 2, | -7 | = 7, | 4 | = 4. The sum of ... Read More

3K+ Views
When we start learning to code, practicing star patterns is one of the best ways to improve logic building. One of the engaging patterns is the triangle pattern. In this article, we are going to learn how to print a Triangle Star Pattern using C++. What is a Triangle Pattern? A triangle pattern is a geometrical arrangement of stars that forms the shape of a triangle. The stars are printed so that if we visualize the pattern as a closed figure, it resembles a triangle. Each row has a different number of stars, increasing as we move downward. The alignment ... Read More

3K+ Views
A capsule is a three-dimensional geometric shape that consists of a cylindrical body with hemispherical ends on both sides. The volume of a capsule can be calculated by adding the volume of the cylindrical part and the volume of the two hemispherical ends present on both sides of the cylindrical part. In this tutorial, we are going to discuss how to find the volume of a given capsule in C++ using different approaches. Formula for Volume of Capsule The formula for the volume of a capsule is as follows: Volume of Capsule = Volume of cylinder + Volume of both ... Read More

2K+ Views
Problem Description In this problem, we are given an unsorted array, and the task is to remove all duplicate elements from the array. The resulting array should only contain unique elements. In this article, we are going to explore different approaches to removing duplicates from an unsorted array in C++. Example 1 Input: array = {4, 3, 2, 4, 1, 3, 2} Output: {4, 3, 2, 1} Explanation: The duplicate elements (4, 3, 2) are removed, leaving only unique elements. Example 2 Input: array ... Read More

2K+ Views
What is Potential Energy? Potential energy is a type of stored energy stored by an object due to its position relative to other objects. It is an important concept in physics and is commonly calculated when studying objects in gravitational fields. In this tutorial, we are going to learn how to calculate the potential energy of an object in C++ if the mass and height are given. Formula for Calculating Potential Energy The formula for potential energy is as follows: Potential Energy = m × g × h Where:m is the mass of the object (in kilograms).g is the gravitational ... Read More

3K+ Views
When we start learning to code, practicing star patterns is one of the best ways to improve logic building. One of the simplest yet fascinating patterns is the hollow square pattern. In this article, we are going to learn how to print a Hollow Square Pattern using C++. What is Hollow Square Pattern? A hollow square pattern is a geometrical arrangement of stars forming a square shape, but the stars are present only at the boundary of the square. The stars are printed in such a manner that the edges of the square are filled with stars, while the interior ... Read More

3K+ Views
The sum of alternate elements has various real-life applications such as signal processing, data compression, pattern recognition, gaming, and financial data analysis. Problem Description In this article, we are going to learn how to find the sum of alternate elements of an array in C++. Alternate elements are present at even or odd indices of the array, depending on how we define them. Example 1 Inputarray = [1, 2, 3, 4, 5] OutputSum_even = 9Sum_odd = 6 Explanation The alternate elements at the even index are 1, 3, 5 (at ... Read More