- 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++
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
4K+ Views
Before digging deep into the topics lets brush up all the related terms.A copy constructor is a special type of constructor that is used to create an object that is an exact copy of the object that is passed.A virtual function is a member function that is declared in the parent class and is redefined ( overridden) in a child class that inherits the parent class.With the use of a virtual copy constructor, the programmer will be able to create an object without knowing the exact data type of the object.In C++ programming language, copy Constructor is used to creating ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
7K+ Views
OpenMP is a set of compiler directives as well as an API for programs written in C, C++, or FORTRAN that provides support for parallel programming in shared-memory environments. OpenMP identifies parallel regions as blocks of code that may run in parallel. Application developers insert compiler directives into their code at parallel regions, and these directives instruct the OpenMP run-time library to execute the region in parallel. The following C program illustrates a compiler directive above the parallel region containing the printf() statement −#include #include int main(int argc, char *argv[]){ /* sequential code */ #pragma omp ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
286 Views
A Pointer is a variable that stores the address of another variable. The data type of the pointer is the same as the data type as the variable.In this puzzle you need to know the size of the pointer that is being used. The puzzle checks our understanding of pointers by asking you the size of variable.The size of int is 4 bytes, whereas the size of int pointer is 8. Now, let’s test your skills with the following exercise in c++ programming language.Example Live Demo#include using namespace std; int main() { int a = 6 ; int ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
143 Views
This C/C++ function call puzzle is a puzzle that is intended to explore more about the behaviour of method calling in both the programming languages C and C++/.The output of a method in C and C++ is different. Lets see what is the difference in calling methods in C and C++.Let’s take an example and check the output of the below code in c and c++.Example Live Demovoid method() { // Print statement } int main() { method(); method(2); }OutputFor C++ −Error : too many arguments to function ‘void method()’For C −Program runs without any error.Logic behind the ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
730 Views
Boolean matrix is a matrix that has only two elements 0 and 1. For this boolean Matrix question, we have a boolean matrix arr[m][n] of size mXn. And the condition to solve is, if m[i][j] = 1 then m[i] = 1 and m[j] = 1 which means all elements of the ith row and jth column will become 1.Let’s take an example, Input: arr[2][2] = 1 0 0 0 Output: arr[2][2] = 1 1 1 0Explanation− arr[0][0] = 1 ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
2K+ Views
Adam Number is a number whose square is reverse of the square of its reverse.Concept Explained − For a number to be adam number, the square of number is reverse of the square of the reverse of the number. Let’s take an example, 12 is the number. Square of 12 is 144 and the reverse of 12 is 21. The square of reverse of 12 i.e. 21 is 441. 441 is the reverse of 144 which is the square of 12.Algorithm to check if a number is adam number −Given the number xy, find the square of the number (xy)2.For ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
116 Views
We have array of unsorted element i.e. arr[] and have an integer K, and we have to find the minimum number of steps needed in which the elements of the array will be added to make all the elements greater than or equal to K. We can add two elements of array and make them one.Example, Input: arr[] = {1 10 12 9 2 3}, K = 6 Output: 2ExplanationFirst we can add (1 + 2), so the new array is 3 10 12 9 3, we can add (3 + 3), So the new array is 6 10 12 ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
241 Views
Finding the array index with the same count of even or odd number is a number that has equal number of either numbers or odd number on both sides of it i.e. no.s at left = no.s right.Here, we need a few definitions that are related to the concept, Array − A container of elements of same data type.Array Index − The position of an element is called its index. Index of array always start from 0.Even number − A number that is divisible by 2.Odd number − A number that is not divisible by 2.A whole number can either ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
182 Views
Array is a container of elements of same data type.Prime Frequencies means that the number of occurrence of the element of the array is a prime number.So, based on these definitions the problem to find array elements with prime frequencies. We are given a string of array. We have to find the frequency of characters and check if frequency is prime and then count elements that have prime frequencies.Let’s take an example, Input: str = “helloworld” Output: 2ExplanationCount of occurrences of characters are −h -> 1 e -> 1 l -> 3 o -> 2 w-> 1 r -> 1 ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
293 Views
This program is to find minimum absolute difference of the array given we have an array which have distinct element.To learn this concept better let’s rebrush the things that required, Array is a container of elements of same data type. The length of an array needs to be predefined.absolute difference is the absolute value of the difference between two numbers i.e. the difference will always be positive, negative values will be converted to positive.The sum of minimum absolute difference of each element has to be found the minimum absolute solute difference formula isMinimum Absolute Difference (a) = min(abs(a – arr[j])) ;where 1 ... Read More