- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 7347 Articles for C++
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
584 Views
Given with the input as an IP address value and the task is to represent the given IP address as its hexadecimal equivalent.What is IP addressIP address or Internet protocol is a unique number to that uniquely describes your hardware connected to a network. Internet means over the network and protocol defines the set of rules and regulations that must be followed for connection. Because of IP address only it is possible for a system to communicate with another system over a network. There are two versions of IP that are −IPv4(Internet Protocol Version 4)IPv6(Internet Protocol Version 6)IP address is ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
843 Views
Given with the input as KiloBytes and the task is to convert the given input into number of bytes and bits.Bit − In computers, bit is the smallest unit represented with two integer value 0 and 1 and all the information in computer is processed as a sequence of these two digits.N-bits = 2 ^ N patterns, where N can be any integer value starting from 1.Byte − In computers, byte is represented with 8 bits. Byte is capable of holding one character to numbers ranging between 0 and 255.1 byte = 8 bitsWhich means 2 ^ 8 patterns which ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
480 Views
Given with the matrix of size nxn the task it to convert any type of given matrix to a diagonal matrix.What is a diagonal MatrixDiagonal matrix is the nxn matrix whose all the non-diagonal elements are zero and diagonal elements can be any value.Given below is the diagram of converting non-diagonal elements to 0.$$\begin{bmatrix}1 & 2 & 3 \4 & 5 & 6 \7 & 8 & 9 \end{bmatrix}\:\rightarrow\:\begin{bmatrix}1 & 0 & 3 \0 & 5 & 0 \7 & 0 & 9 \end{bmatrix}$$The approach is to start one loop for all non-diagonal elements and another loop for diagonal elements ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
89 Views
Suppose we two integers N and P. The P is the product of N unknown integers. We have to find the GCD of those integers. There can be different groups of integers possible, that will give the same result. Here we will produce GCD, which is maximum among all possible groups. Suppose N = 3, and P = 24, then different groups will be like {1, 1, 24}, {1, 2, 12}, {1, 3, 8}, {1, 4, 6}, {2, 2, 6}, {2, 3, 4}. The GCDs are: 1, 1, 1, 1, 2, 1. So answer is 2 here.The technique us like, ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
331 Views
Suppose we have a binary string of length n, another value say k is given. We have to concatenate the binary string k times. Then we have to find the maximum number of consecutive 0s in the concatenated string. Suppose binary string is “0010010”, and k = 2, then after concatenating the string k times, it will be “00100100010010”. So the maximum number of consecutive 0s is 3.The approach is simple. If the number has all 0s, then the answer will be n * k. If the string contains ones, then the result will be either the max length of ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
698 Views
Here we will see one problem. Suppose one array arr is given. We have to check whether the array can be split into two parts, such that −Sub of both sub-arrays will be the sameAll elements, which are multiple of 5, will be in the same groupAll elements which are multiple of 3, but not multiple of 5, will be in the same groupAll other elements will be in other groups.Suppose the array elements are {1, 4, 3}, then this can be split, because the sum of {1, 3} is the same as the sum of {4}, and the groups ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
783 Views
In this program, we have to find the area of a polygon. The coordinates of the vertices of this polygon are given. Before we move further lets brushup old concepts for a better understanding of the concept that follows.The area is the quantitative representation of the extent of any two-dimensional figure.Polygon is a closed figure with a given number of sides.Coordinates of vertices are the value of points in the 2-d plane. For example (0, 0).Now, let's see the mathematical formula for finding the area.FormulaArea = ½ [(x1y2 + x2y3 + …… + x(n-1)yn + xny1) - (x2y1 + x3y2 ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
772 Views
In this problem for finding the area of an n-sided regular polygon with a given side, we will derive the formula for the area of the figure and create a program based on it. But before that let's revise the basics to understand the topic easily.An N-sided regular polygon is a polygon of n side in which all sides are equal. For example regular pentagon, regular hexagon, etc.The area is the quantitative representation of the extent of any two-dimensional figure.To find the area of this figure we need to find the area of individual triangles in the figure and multiply ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
128 Views
In this problem, we will calculate the area of the circumscribed circle of a square when we are given the side of the square. Before we go further let’s revise the basic definitions to understand the concepts better.Square is a quadrilateral with all sides equal.The circumscribing circle is a circle touches all the vertices of a polygon.The area is the quantitative representation of the extent of any two-dimensional figure.To calculate the area of the circumscribed circle of a square. We need to find the relation between the parameter of the circle and the square.Now, as in the figure, all the ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
575 Views
Sorting the elements of an integer array in such a way that the first element is the maximum of the array and the second element of the sorted array is the minimum, the third one is the second minimum, the fourth one is the second maximum of the array and goes on.Let’s take an example to understand the concept better, Input : 4 1 8 2 9 3 7 Output : 9 1 8 2 7 3 4 Explanation : The elements in a sorted way is 1 2 3 4 7 8 9. Now, let’s create it in ... Read More