Found 7346 Articles for C++

Transform a string such that it has abcd..z as a subsequence

Rudradev Das
Updated on 05-Apr-2023 17:51:10

122 Views

Transforming a string aka string transformation is an operation in C++ by which the result stores in an output array after the execution of the whole process. In C++ there is a function called "transform()", present in the directory of the C++ environment by which we can transform a string into a new one. There are two forms of this transform function − Unary operation Operation applies on the every element of the input array. After the operation being done the result will store in an output array. Binary operation Operation applies on each element ... Read More

Strong Password Suggester Program

Rudradev Das
Updated on 05-Apr-2023 17:16:05

541 Views

Every year on 7th May the worldwide organizations remind there users about the significance of a strong password. As per the tech giant Google; 24% of their end users have used the word "password" or "Qwerty" as their account password. While, only 34% from their total users change their account passwords in a frequent manner. In this tech-forward world today, every login attempt has a chance of a cyber criminal attack. But many people now a days still using the weak passwords for their professional and personal accounts. Here we will discuss and check, whether the created passwords ... Read More

Program to check the similarity of given two triangles

Simran Kumari
Updated on 23-Mar-2023 14:49:07

352 Views

In this problem, we will learn to check the similarity of two given triangles, which have many real-world use cases from the viewpoint of a programmer. To construct and manage 2D and 3D models of things, CAD systems are utilized, and one key function is the capability to compare two triangles. For instance, engineers working in design and construction may need to make that the foundational measurements of a building match the blueprint. Engineers can rapidly evaluate whether the angles and sides of the foundation game the layout by utilizing a CAD tool that has a built-in feature to check ... Read More

Program to calculate the Surface Area of a Triangular Prism

Simran Kumari
Updated on 23-Mar-2023 14:40:10

320 Views

Let us see how to write a program to calculate the Surface Area of a Triangular Prism. It might seem very basic to calculate the surface area of a triangular prism, but there are various areas where programmers may feel the need for it. Some of the common scenarios are listed below − 3D graphics and animation − While constructing 3D models, animators and game developers may need to compute the surface area of a triangular prism in order to correctly represent it in a virtual world. Engineers and architects may need to determine the surface area of ... Read More

Number of triangles in a plane if no more than two points are collinear

Simran Kumari
Updated on 23-Mar-2023 14:35:32

165 Views

Let us see how to calculate the number of triangles in a plane with n number of points given, with the constraint that not more than two points are collinear. Computing the number of triangles in a plane with no more than two collinear points is a typical problem in computational geometry, and it is used in computer graphics, image processing, and other areas of computer science. While creating a 2D image from a 3D scene in 3D graphics, for instance, the issue of counting triangles in a plane with no more than two points collinear can come up. The ... Read More

Different ways to represent N as the sum of K non-zero integers

Simran Kumari
Updated on 23-Mar-2023 14:31:37

575 Views

The problem “Different ways to represent N as the sum of K non-zero integers” has many real-world use cases. Cryptography − In cryptography, specific cryptographic methods are designed using the concept of encoding a number N as the sum of K non-zero integers. Representing an integer N as the sum of K non-zero integers might appear as a subproblem in different optimization issues in the context of optimization methods. Machine learning − In machine learning, feature vectors that depict the distribution of data points can be created by using the problem of representing an integer N as the sum of ... Read More

Vieta’s Formulas

Rinish Patidar
Updated on 16-Mar-2023 11:01:17

3K+ Views

In mathematics, Vieta’s formulas are the concept of polynomials which relates a polynomial’s coefficients to the sums and products of the roots of the polynomial. Vieta’s formulas can be useful tools for learning relations between the polynomial’s roots without really knowing their numerical value and coefficients of the equation. We will be focusing on the concept of Vieta’s formulas and try to solve some problems using this formula in this article. Vieta’s Formulas The formulas developed by the mathematician Vieta establish the relationship between the sum and product of any polynomial’s roots and its coefficients. Since this formula deals with ... Read More

Subsequence of size k with maximum possible GCD

Rinish Patidar
Updated on 16-Mar-2023 10:58:17

597 Views

The problem statement says we will be given an array as input and a positive integer K, we need to figure out the maximum possible gcd(greatest common divisor) of a ksized subsequence of an array in this problem. It can be solved using different algorithms to find gcd of the numbers and figuring out the maximum gcd for a k-sized subsequence. Before that we must know about the subsequence of an array. A subsequence of an array is a sequence of numbers from the array not necessarily adjacent numbers in the array but the order of the numbers in the ... Read More

Smarandache-Wellin Sequence

Rinish Patidar
Updated on 16-Mar-2023 10:55:17

241 Views

The problem includes printing first m terms of Smarandache-Wellin Sequence where m is any positive integer. We will see the algorithm to print the first m term of Smarandache-Wellin Sequence in C++. But before that we must know about the Smarandache-Wellin sequence. A Smarandache-Wellin sequence is a sequence of Smarandache-Wellin numbers. Smarandache-Wellin numbers are the integers which are formed by concatenation of the consecutive prime numbers. The first few prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23…. The first Smarandache-Wellin number of the sequence is 2. The second number of the sequence is 23, which ... Read More

Program to compare m^n and n^m

Rinish Patidar
Updated on 16-Mar-2023 10:53:12

230 Views

The problem statement states that we need to write a program to compare m^n and n^m. We need to figure out the algorithm to calculate $m^{n}$ and $n^{m}$ and compare them and print accordingly if $m^{n}$ is greater than $n^{m}$, or if $m^{n}$ is less than $n^{m}$ , or if they both are equal. We will be given two positive numbers, m and n and we need to find out $m^{n}$ and $n^{m}$ and compare both the values. For example, INPUT : m=2 , n=5 OUTPUT : m^n is greater than n^m. Explanation : $m^{n}$ which is 25 = 32 ... Read More

Advertisements