- 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 34494 Articles for Programming
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
579 Views
A structure is a collection of items of different data types. It is very useful in creating complex data structures with different data type records. A structure is defined with the struct keyword.An example of a structure is as follows −struct DistanceFI { int feet; int inch; };The above structure defines a distance in the form of feet and inches.A program to add two distances in inch-feet using a structure in C++ is given as follows −Example Live Demo#include using namespace std; struct DistanceFI { int feet; int inch; }; int main() { struct DistanceFI distance1, distance2, distance3; cout
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
812 Views
A vector is a dynamic array that can resize itself if an element is inserted or deleted. The vector elements are contained in a contiguous storage and the container handles the storage automatically.A program that implements vectors is given as follows −Example#include #include #include #include using namespace std; int main() { int ch, val; vector vec; cout
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
6K+ Views
Variable length arrays can have a size as required by the user i.e they can have a variable size.A program to implement variable length arrays in C++ is given as follows −Example Live Demo#include #include using namespace std; int main() { int *array, size; cout
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
4K+ Views
A parallel array is a structure that contains multiple arrays. Each of these arrays are of the same size and the array elements are related to each other. All the elements in a parallel array represent a common entity.An example of parallel arrays is as follows −employee_name = { Harry, Sally, Mark, Frank, Judy } employee_salary = {10000, 5000, 20000, 12000, 5000}In the above example, the name and salary of 5 different employees is stored in 2 arrays.A program that demonstrates parallel arrays is given as follows −Example#include #include using namespace std; int main() { int ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
1K+ Views
In a computer system, the binary number is expressed in the binary numeral system while the octal number is in the octal numeral system. The binary number is in base 2 while the octal number is in base 8.Examples of binary numbers and their corresponding octal numbers are as follows −Binary NumberOctal Number011011500101510110260101012A program that converts the octal numbers into binary is given as follows −Example Live Demo#include #include using namespace std; int OctalToBinary(int octalNum) { int decimalNum = 0, binaryNum = 0, count = 0; while(octalNum != 0) { decimalNum += (octalNum%10) ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
703 Views
In a computer system, the binary number is expressed in the binary numeral system while the octal number is in the octal numeral system. The binary number is in base 2 while the octal number is in base 8.Examples of binary numbers and their corresponding octal numbers are as follows −Binary NumberOctal Number010101200111711001311000020A program that converts the binary numbers into octal and the octal numbers into binary is given as follows −Example Live Demo#include #include using namespace std; int BinarytoOctal(int binaryNum) { int octalNum = 0, decimalNum = 0, count = 0; while(binaryNum != 0) { ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
4K+ Views
The LU decomposition of a matrix produces a matrix as a product of its lower triangular matrix and upper triangular matrix. The LU in LU Decomposition of a matrix stands for Lower Upper.An example of LU Decomposition of a matrix is given below −Given matrix is: 1 1 0 2 1 3 3 1 1 The L matrix is: 1 0 0 2 -1 0 3 -2 -5 The U matrix is: 1 1 0 0 1 -3 0 0 1A program that performs LU Decomposition of a matrix is given below −Example#include using namespace std; void LUdecomposition(float a[10][10], float ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
650 Views
Fisher-Yates algorithm generates a random permutation of the array elements i.e. it randomly shuffles all the elements of an array. All the permutations for the array are equally likely as the Fisher-Yates algorithm is unbiased.A program to implement the Fisher-Yates Algorithm for array shuffling in C++ is given as follows −Example#include #include using namespace std; int main() { int n; cout
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
5K+ Views
The Greatest Common Divisor (GCD) of two numbers is the largest number that divides both of them.For example: Let’s say we have two numbers that are 63 and 21.63 = 7 * 3 * 3 21 = 7 * 3So, the GCD of 63 and 21 is 21.The recursive Euclid’s algorithm computes the GCD by using a pair of positive integers a and b and returning b and a%b till b is zero.A program to find the GCD of two numbers using recursive Euclid’s algorithm is given as follows −Example Live Demo#include using namespace std; int gcd(int a, int b) ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
5K+ Views
Complex numbers are numbers that are expressed as a+bi where i is an imaginary number and a and b are real numbers. Some examples on complex numbers are −2+3i 5+9i 4+2iA program to perform complex number multiplication is as follows −Example Live Demo#include using namespace std; int main(){ int x1, y1, x2, y2, x3, y3; cout y1; cout y2; x3 = x1 * x2 - y1 * y2; y3 = x1 * y2 + y1 * x2; cout