- 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)
543 Views
A sparse matrix is a matrix in which majority of the elements are 0. In other words, if more than half of the elements in the matrix are 0, it is known as a sparse matrix. For example −The matrix given below contains 5 zeroes. Since the number of zeroes is more than half the elements of the matrix, it is a sparse matrix.1 0 2 5 0 0 0 0 9A program to check if it is a sparse matrix or not is as follows.Example Live Demo#include using namespace std; int main () { int a[10][10] = { {2, ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
8K+ Views
A matrix is a rectangular array of numbers that is arranged in the form of rows and columns.An example of a matrix is as follows.A 3*2 matrix has 3 rows and 2 columns as shown below −8 1 4 9 5 6A program that performs matrix multiplication is as follows.Example Live Demo#include using namespace std; int main() { int product[10][10], r1=3, c1=3, r2=3, c2=3, i, j, k; int a[3][3] = { {2, 4, 1} , {2, 3, 9} , {3, 1, 8} }; int b[3][3] = { {1, 2, 3} , {3, 6, 1} , {2, 4, 7} }; if (c1 != r2) { cout
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
12K+ Views
Factorial of a non-negative integer n is the product of all the positive integers that are less than or equal to n.For example: The factorial of 4 is 24.4! = 4 * 3 * 2 *1 4! = 24The factorial of an integer can be found using a recursive program or an iterative program.The following program demonstrates a recursive program to find the factorial of a number −Example Live Demo#include using namespace std; int fact(int n) { if ((n==0)||(n==1)) return 1; else return n*fact(n-1); } int main() { int n = 4; cout
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
3K+ Views
Factorial of a non-negative integer n is the product of all the positive integers that are less than or equal to n.For example: The factorial of 6 is 720.6! = 6 * 5 * 4 * 3 * 2 *1 6! = 720The factorial of an integer can be found using a recursive program or an iterative program.A for loop can be used to find the factorial of a number using an iterative program. This is demonstrated as follows.Example Live Demo#include using namespace std; int main() { int n = 6, fact = 1, i; for(i=1; i
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
15K+ Views
A string is a one-dimensional character array that is terminated by a null character. Frequency of characters in a string is the number of times they occur in a string. For example −String: Football is a sport The frequency of alphabet o in the above string is 3A program to find the frequency of a particular alphabet is given as follows.Example Live Demo#include using namespace std; int main() { char str[100] = "this string contains many alphabets"; char c = 'a'; int count = 0; for(int i = 0; str[i] != '\0'; i++) { if(str[i] == c) count++; } cout
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
1K+ Views
In a computer system, the octal number is expressed in the octal numeral system while the decimal number is in the decimal numeral system. The octal number is in base 8 while the decimal number is in base 10.Examples of decimal numbers and their corresponding octal numbers are as follows.Decimal NumberOctal Number81070106253177A program that converts the decimal numbers into octal is as follows.Example Live Demo#include using namespace std; void DecimalToOctal(int decimalNum) { int octalNum = 0, placeValue = 1; int dNo = decimalNum; while (decimalNum != 0) { octalNum += (decimalNum % 8) * placeValue; decimalNum /= 8; placeValue *= 10; } cout
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
582 Views
A string is a one-dimensional character array that is terminated by a null character. It may contain characters, digits, special symbols etc.A program to remove all characters in a string except alphabets is given as follows.Example#include using namespace std; int main() { char str[100] = "String@123!!"; int i, j; cout
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
3K+ Views
A string is a one dimensional character array that is terminated by a null character. The value of a string can be copied into another string. This can either be done using strcpy() function which is a standard library function or without it.The program to copy a string without using strcpy() function is given as follows −Example Live Demo#include using namespace std; int main() { char str1[100] = "Magic"; char str2[100]; int i; for(i = 0; str1[i] != '\0'; i++) str2[i] = str1[i]; str2[i] = '\0'; cout
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
68 Views
The realpath_cache_get() function returns realpath cache entries. It returns an array of realpath cache entries.Syntaxrealpath_cache_get()ParametersNAReturnThe realpath_cache_get() function returns an array of realpath cache entries.Example Live DemoOutputArray ( [/home] => Array ( [key] => 4353355791257440477 [is_dir] => 1 [realpath] => /home [expires] => 1538630044 ) [/home/cg/root] => Array ( [key] => 1131813419205508649 [is_dir] => 1 [realpath] => /home/cg/root [expires] => 1538630044 ) [/home/cg/root/8944881/main.php] => Array ( [key] => 584844883037958768 [is_dir] => [realpath] => /home/cg/root/8944881/main.php [expires] => 1538630044 ) [/home/cg] => Array ( [key] => 9037225891674879750 [is_dir] => 1 [realpath] => /home/cg [expires] => 1538630044 ) [/home/cg/root/8944881] => Array ( [key] => 722006552431300374 [is_dir] => 1 [realpath] => /home/cg/root/8944881 [expires] => 1538630044 ) )