- 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)
946 Views
Three numbers can be swapped in cyclic order by passing them to a function cyclicSwapping() using call by reference. This function swaps the numbers in a cyclic fashion.The program to swap numbers in cyclic order using call by reference is given as follows −Example Live Demo#include using namespace std; void cyclicSwapping(int *x, int *y, int *z) { int temp; temp = *y; *y = *x; *x = *z; *z = temp; } int main() { int x, y, z; cout > y >> z; cout
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
20K+ Views
Static data members are class members that are declared using the static keyword. There is only one copy of the static data member in the class, even if there are many class objects. This is because all the objects share the static data member. The static data member is always initialized to zero when the first class object is created.The syntax of the static data members is given as follows −static data_type data_member_name;In the above syntax, static keyword is used. The data_type is the C++ data type such as int, float etc. The data_member_name is the name provided to the ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
3K+ Views
The isspace() function is a predefined function in ctype.h. It specifies whether the argument is a whitespace character or not. Some of the whitespace characters are space, horizontal tab, vertical tab etc.A program that implements isspace() function by counting the number of spaces in a string is given as follows −Example Live Demo#include #include using namespace std; int main() { char str[] = "Coding is fun"; int i, count = 0; for(i=0; str[i]!='\0';i++) { if(isspace(str[i])) count++; } cout
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
5K+ Views
Multiple inheritance occurs when a class inherits from more than one base class. So the class can inherit features from multiple base classes using multiple inheritance. This is an important feature of object oriented programming languages such as C++.A diagram that demonstrates multiple inheritance is given below −A program to implement multiple inheritance in C++ is given as follows −Example Live Demo#include using namespace std; class A { public: int a = 5; A() { cout
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
1K+ Views
The strstr() function is a predefined function in string.h. It is used to find the occurance of a substring in a string. This process of matching stops at ‘\0’ and does not include it.Syntax of strstr() is as follows −char *strstr( const char *str1, const char *str2)In the above syntax, strstr() finds the first occurance of string str2 in the string str1. A program that implements strstr() is as follows −Example Live Demo#include #include using namespace std; int main() { char str1[] = "Apples are red"; char str2[] = "are"; char *ptr; ptr = strstr(str1, str2); if(ptr) cout
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
23K+ Views
A substring is a part of a string. A function to obtain a substring in C++ is substr(). This function contains two parameters: pos and len. The pos parameter specifies the start position of the substring and len denotes the number of characters in a substring.A program that obtains the substring in C++ is given as follows −Example Live Demo#include #include using namespace std; int main() { string str1 = "Apples are red"; string str2 = str1.substr(11, 3); string str3 = str1.substr(0, 6); cout
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
1K+ Views
Bitwise operators are used to perform bitwise operations. That implies the manipulation of bits. Some of the bitwise operators are bitwise AND, bitwise OR, bitwise XOR etc.A program to perform addition operation using bitwise operators is given below −Example Live Demo#include using namespace std; int main() { int num1, num2, carry; cout
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
406 Views
Random numbers can be generated in C++ using the rand() function. The srand() function seeds the random number generator that is used by rand().A program that uses rand() and srand() is given as follows −Example Live Demo#include #include #include using namespace std; int main() { srand(1); for(int i=0; i
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
1K+ Views
Lexicographical order denotes the way the words are ordered in a list, based on alphabetical order according to their alphabets. For example −List of words: Harry Adam Sam Lexicographical order of words: Adam Harry SamA program to sort elements in lexicographical order is as follows −Example Live Demo#include using namespace std; int main() { int i,j; string s[5], temp; cout
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
602 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+5i 3-9i 8+2iA program to add complex numbers by passing structure to a function is given as follows −Example Live Demo#include using namespace std; typedef struct complexNumber { float real; float imag; }; complexNumber addCN(complexNumber num1, complexNumber num2) { complexNumber temp; temp.real = num1.real + num2.real; temp.imag = num1.imag + num2.imag; return(temp); } int main() { complexNumber num1, num2, sum; cout num1.real; ... Read More