
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 7197 Articles for C++

267 Views
The function iswupper() is a built-in function in C/C++. It converts the wide character into upper case. It is declared in “cwctype” header file in C++ language while “ctype.h” in C language. It takes a single character which is known as wide character. If the character is upper case, it is converted into it, otherwise no modifications happen.Here is the syntax of towupper() in C++ language, wint_t towupper( wint_t ch );Here is an example of towupper() in C++ language, Example#include #include #include using namespace std; int main() { wchar_t s[] = L"hello world!"; wcout Read More

221 Views
The function iswlower() is a built-in function in C/C++. It checks whether the wide character is in lower case or not. It is declared in “cwctype” header file in C++ language while “ctype.h” in C language. It takes a single character which is known as wide character. It will return zero(0), if the character is not a lower case character. It will return non-zero value, if character is lower case.Here is the syntax of iswlower() in C/C++ language, int iswlower(ch);Here is an example of iswlower() in C++ language, Example Live Demo#include #include using namespace std; int main() { ... Read More

2K+ Views
The loss of type and dimensions of an array is known as array decay. It occurs when we pass the array into a function by pointer or by value. Only the address of the first element is sent, which is treated as a pointer. As a result, the original array's size and type information are lost. Because of this decay, sizeof no longer gives the full size of the array but instead returns the size of the pointer. This can cause incorrect behavior in functions that depend on knowing the number of elements. Example of Array ... Read More

800 Views
Enumeration is a user defined datatype in C language. It is used to assign names to the integral constants, which makes a program easy to read and maintain. The keyword “enum” is used to declare an enumeration.Here is the syntax of enum in C language, enum enum_name{const1, const2, ....... };The enum keyword is also used to define the variables of enum type. There are two ways to define the variables of enum type as follows.enum week{sunday, monday, tuesday, wednesday, thursday, friday, saturday}; enum week day;Here is an example of enum in C language, Example#include enum week{Mon=10, Tue, Wed, Thur, Fri=10, ... Read More

27K+ Views
The function strcmp() is a built-in library function and it is declared in “string.h” header file. This function is used to compare the string arguments. It compares strings lexicographically which means it compares both the strings character by character. It starts comparing the very first character of strings until the characters of both strings are equal or NULL character is found.If the first character of both strings are equal, it checks second character and so on. This process will be continued until NULL character is found or both characters are unequal.Here is the syntax of strcmp() in C language, int ... Read More

184 Views
The sinh() function returns the hyperbolic sine of an angle given in radians. It is an inbuilt function in C++ STL.The syntax of the sinh() function is given as follows.sinh(var)As can be seen from the syntax, the function sinh() accepts a parameter var of data type float, double or long double. It returns the hyperbolic sine of var.A program that demonstrates sinh() in C++ is given as follows.Example Live Demo#include #include using namespace std; int main() { double d = 5, ans; ans = sinh(d); cout

555 Views
The function strncat() in C++ is used for concatenation. It appends the specified number of characters from the source string at the end of the destination string and returns a pointer to the destination string. The syntax of strncat() is given as follows.char * strncat ( char * dest, const char * src, size_t num );In the above syntax, the source string src is appended at the end of the destination string dest till num characters only.A program that demonstrates strcat() is given as follows.Example Live Demo#include #include using namespace std; int main() { char str1[20] = "Programming ... Read More

719 Views
Both strcat() and strncat() are predefined string functions in C++. Details about these are given as follows.strcat()This function is used for concatenation. It appends a copy of the source string at the end of the destination string and returns a pointer to the destination string. The syntax of strcat() is given as follows.char *strcat(char *dest, const char *src)A program that demonstrates strcat() is given as follows.Example Live Demo#include #include using namespace std; int main() { char str1[20] = "Mangoes are "; char str2[20] = "yellow"; strcat(str1, str2); cout

1K+ Views
Tree traversal is a form of graph traversal. It involves checking or printing each node in the tree exactly once. The preorder traversal of a binary search tree involves visiting each of the nodes in the tree in the order (Root, Left, Right). An example of Preorder traversal of a binary tree is as follows. Here, we start at the root(3), then go to the left child (6), then its left(5), then right(2), then come back and move to the right subtree of 3 that is (4), then 9, and finally 8. Non-Recursive Preorder Traversal of ... Read More

6K+ Views
The factorial of a positive integer n is equal to 1*2*3*...n. Factorial of a negative number does not exist. Here a C++ program is given to find out the factorial of a given input using dynamic programming.AlgorithmBegin fact(int n): Read the number n Initialize i = 1, result[1000] = {0} result[0] = 1 for i = 1 to n result[i] = I * result[i-1] Print result EndExample Code#include using namespace std; int result[1000] = {0}; int fact(int n) { if (n >= 0) { result[0] = 1; for (int i = 1; i