Found 7347 Articles for C++

The abs(), labs(), llabs() functions in C/C++

sudhir sharma
Updated on 04-Oct-2019 08:00:18

899 Views

What are Integer Functions in C Library?Integer functions are those functions which returns the exact value of an integer. C only supports integer values. In this function the nearest integer which is less than or equal to the argument returns to this function.Types of Integer functions −int = abs (int n); long = labs (long n); long long = llabs (long long n);where n = integer valueWhat is abs(), labs(), llabs() functions ?They are defined as (C Standard General Utilities Library) header file. They give the exact value of integer that is input to them as their argument.abs() function ... Read More

C++ Sum Array Puzzle

sudhir sharma
Updated on 04-Oct-2019 07:57:36

166 Views

Array is a data structure that stores multiple elements of the same data type. It can store entire set of values at once. But its length needs to be defined beforehand.In this sum array puzzle, we are given an array A1 of a definite size say n. In order to solve this puzzle, we will create an array called S1 that stores the sum of all elements of the array except the element whose position is being used. For example, if S1[3] is being calculated then we will find the sum of all elements of A1 except the element at ... Read More

Write program to shutdown a system in C/C++

sudhir sharma
Updated on 04-Oct-2019 07:54:57

259 Views

A program to shutdown the system works on the operating systems like windows, linux or macOS. To shut it off and close all opened applications.What shut down or power off means?Shut down or Power off a computer means removing power from a computer's main components in an organised prescribed way and turning off all the works that are done by the computer i.e. all applications and processings are shut off. After a computer is shut down, the main components such as CPU, RAM modules and hard disk drives are powered down, although some internal components, such as an internal clock, ... Read More

C++ program to find the Area of the Largest Triangle inscribed in a Hexagon?

sudhir sharma
Updated on 04-Oct-2019 07:52:34

184 Views

Find the area of largest Triangle inscribed in a hexagon we need to learn these figures are and how 1 is inscribed inside other.Triangle is a closed figure with 3 sides which may be equal or different size.Hexagon is a closed figure with 6 sides which may be equal or unequal in size.A triangle inscribed inside a hexagon has all its vertices touching vertices of hexagon. So, the sides of the triangle can be treated as diagonals of a regular hexagon. The hexagon considered here is a regular hexagon, which leads to make the largest triangle an Equilateral triangle.Let’s derive ... Read More

C++ program to find the Area of the circumcircle of any triangles with sides given?

sudhir sharma
Updated on 04-Oct-2019 07:41:36

142 Views

To calculate the area of circumcircle of any triangles. We need to learn about basic concepts related to the problem.Triangle − A closed figure with three sides.Circle − A closed figure with infinite number or side or no sides.A circle that encloses other figure inside it is a circumcircle.A circumcircle touches the triangle from all its points. Lets say its sides are a, b, c then the radius of the circumcircle is given by the mathematical formula −r = abc / (√((a+b+c))(a+b-c)(a+c-b)(b+c-a)))The area of the circle with radius r isarea = 2 * (pie) * r *r.Let’s take a few ... Read More

Angle between two Planes in 3D in C++?

sudhir sharma
Updated on 04-Oct-2019 07:30:39

182 Views

For learning about the angle between two planes in 3D, we need to learn about planes and angles.Plane is a two-dimensional surface that extends to infinity.Angle is the space in degrees between two lines and surfaces which intersect at a point.So, in this problem we need to find the angle between two 3D planes. For this we have two planes that intersect each other and we need to find the angle at which the are intersecting each other.To calculate the angle between two 3D planes, we need to calculate the angle between the normal's of these planes.Here, we have two ... Read More

Bellman Ford Algorithm in C++?

sudhir sharma
Updated on 04-Oct-2019 07:21:19

4K+ Views

Bellman Ford Algorithm is dynamic programming algorithm which is used to find the shortest path of any vertex computed from a vertex treated as starting vertex. this algorithm follows iterative method and continuously tries to find shortest Path. The Bellman Ford Algorithm on weighted graph.this algorithm was proposed by Alphonso shimbel in 1955. The algorithm has revisions by Richard Bellman and Lester Ford in the year 1956 and 1958, due to this algorithm was named Bellman Ford Algorithm. This algorithm was also revised by Eward F. Moore in 1957, which made its name to Bellman-Ford-Moore Algorithm.This algorithm is better as ... Read More

C++ bitset interesting facts?

sudhir sharma
Updated on 04-Oct-2019 07:08:49

210 Views

C++ programming language defines a container in c++ standard Template Library named as bitset. This bitset container is used in order to work on elements at the bit level i.e. each bit of the variable the bits i.e. binary conversion of the given value.1. Bitset is like an string − Bitset is a container of bits ( only 0 and 1 are valid ). You can create a bitset with any set of bits specified by start index value of the bitset and the number of elements that are considered i.e. you can create a bitset with 2 elements starting ... Read More

Angular Sweep Algorithm in C++

sudhir sharma
Updated on 04-Oct-2019 06:48:06

383 Views

The algorithm to find the maximum number of points that can be enclosed in a circle of a given radius. This means that for a circle of radius r and a given set of 2-D points, we need to find the maximum number of points that are enclosed (lying inside the circle not on its edges) by the circle.For, this is the most effective method is the angular sweep algorithm.AlgorithmThere are nC2 points given in the problem, we need to find the distance between each of these points.Take an arbitrary point and get the maximum number of points lying in ... Read More

C++ set for user defined data type?

sudhir sharma
Updated on 04-Oct-2019 06:43:38

286 Views

A set is a data structure that stores numeric values. The speciality of sets is that the elements are distinct (i.e. no two elements have the same value). Also the values are stored in ascending order. You can explicitly define the data type of a set in C++ i.e. a user defined data type for a set.To store data in distinct form and in a sorted order. Let’s take an example, Input : 124689781230 Output : 1230467889LogicIn a set the input can be in any order and there can be duplicate value. But the set will store only distinct ... Read More

Advertisements