
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 7332 Articles for C++

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

133 Views
The Sublime Text is a popular code editor due to its simplicity, speed and extensibility. While it may not have built-in C++ support, it's very easy to set up Sublime Text for competitive programming in C++. This guide will walk you through configuring Sublime Text to provide a smooth and efficient environment for C++ competitive programming. Steps to Set Up Sublime Text for C++ Competitive Programming 1. Install Sublime TextFirst, we need to install Sublime Text if you haven't already. Go to the Sublime Text website. Download and install the ... Read More

4K+ Views
Problem Description In this problem, we are given coordinate points of a 2-dimensional plane and a 3-dimensional plane, and we have to find the distance between these two points. In this article, we are going to discuss how we can find the distance between two points in C++. Approaches to Calculate Distance Between Two Points To solve this problem, here are the two approaches that can you use: Using 2D Coordinates Using 3D Coordinates Using 2D Coordinates In this approach, we use the direct distance formula to calculate ... Read More

4K+ Views
Problem Description In this problem, we are given an array that contains all unique elements except one element which is present exactly two times in the array. We have to return that element which is present two times in the array. In this article, we are going to learn how we can find duplicates in an array of N+1 integers in C++. Example Input: array = {1, 3, 4, 2, 2} Output: 2 Explanation: 2 is the only element in the array that occurs two times. Approaches to Find Duplicate Element in an Array ... Read More

3K+ Views
Problem Description We are given the three sides of a triangle, and we have to calculate the area of the triangle using Heron's formula. In this article, we are going to discuss how we can calculate the area of a triangle using Heron's Formula in C++. Heron's Formula The formula for calculating the semi-perimeter of the triangle is: s = (a + b + c) / 2 Then, apply Heron's formula to calculate the area of the triangle. Heron's formula for calculating the area of the triangle is: Area = √ s * (s - a) * (s - ... Read More

4K+ Views
Problem Description In this problem, we are given a number and have to check whether this number is greater than zero. Using the if-else and ternary approach to check if the given number is greater than zero, equal to zero, or less than zero. In this article, we will discuss how we can find if a given number is greater than zero or not in C++. Prerequisite If-else operator: This operator allows the program to execute certain code blocks based on whether a condition is true or false. Syntax of If-else operator if (condition) { // ... Read More

7K+ Views
Problem Description In this problem, we are given two numbers and we have to find the value obtained after subtracting one number from another. In this article, we are going to learn how we can subtract two numbers in C++ using different approaches. Example 1 Input number1 = 8number2 = 12 Output 4 Explanation The subtraction of number2 - number1 i.e. 12 - 8 will result in 4. Example 2 ... Read More

3K+ Views
What is a Vector in C++?A vector is a dynamic array as the size of the vector changes during the program's execution. If we insert more elements in the vector it expands its size and if we remove elements from the vector it shrinks in size. A vector is part of the Standard Template Library (STL). Problem DescriptionIn this problem, we are given a vector and have to insert an element at a certain position. In this article, we are going to learn how to insert multiple positions in a vector in C++ using different approaches. Below are some examples to ... Read More

3K+ Views
What is Geometric Progression? A geometric progression is a sequence of numbers where each term is obtained by multiplying the previous term by a fixed number. This fixed number is known as the common ratio and it should be a non-zero. In this article, we are going to learn how we can find the sum of given n terms in geometric progression in C++. We are given first-term, common ratio, and number of terms for which we have to find the sum of geometric progression. Formula for Calculating Sum of Geometric Progression Sn= a (1 - rn)/(1 - r) ... Read More

4K+ Views
Pythagorean Triples Pythagorean triples are a set of three distinct numbers a, b, and c which satisfy the condition: a2 + b2 = c2 These numbers a, b, and c are known as Pythagorean triples. We can say that these three numbers represent the sides of a right-angled triangle. These three sides are known as triplets of the array. Problem Description We are given an array of integers, and we have to find if there exist three distinct numbers in the array which form the Pythagorean triplet in C++. Below are examples to demonstrate the problem statement clearly: ... Read More