Server Side Programming Articles - Page 2399 of 2650

C++ Program to Store and Display Information Using Structure

Nishu Kumari
Updated on 16-May-2025 19:14:01

8K+ 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. In this article, we will store and display information of an employee using a structure. An example of a structure is as follows: struct employee { int empID; char name[50]; int salary; char department[50]; }; Store Information in Structure and Display It In this program, we store and display employee information using a ... Read More

C++ Program to Calculate Standard Deviation

Nishu Kumari
Updated on 21-May-2025 09:46:51

9K+ Views

Standard deviation is a measure of how spread out the numbers in a dataset are. It is the square root of the variance, where variance is the average of the squared differences from the mean. In this article, we will show you how to calculate the standard deviation in C++. Let's understand this with an example: Input: Numbers are 4, 8, 6, 5, 8 Calculating: Find the mean = (4 + 8 + 6 + 5 + 8) / 5 = 31 / 5 = 6.2 Subtract the mean and square the result: (4 - 6.2)^2 = ... Read More

C++ Program to Check if it is a Sparse Matrix

Nishu Kumari
Updated on 16-May-2025 19:14:48

797 Views

What is Sparse Matrix?A sparse matrix is a matrix in which the majority of the elements are zero. In other words, if more than half of the elements in a matrix are 0, it is called a sparse matrix. In this article, we will show you how to write a C++ program to check whether a given matrix is sparse or not. Let's understand this with an example. The matrix shown below contains 5 zeros. Since the number of zeros is more than half of the total elements (9), it is a sparse matrix: 1 0 2 5 0 ... Read More

C++ Program to Perform Matrix Multiplication

Nishu Kumari
Updated on 16-May-2025 18:37:23

10K+ Views

A matrix is a rectangular array of numbers arranged in rows and columns. To multiply two matrices, We multiply each row of the first matrix by each column of the second matrix and add the results to get a new matrix. An example of the multiplication of two matrices is as follow: Steps for Matrix Multiplication To multiply the matrices, we use pointers in C++, which means we directly access the elements through their memory addresses to read and calculate the values. Below are the steps we took: We first define the number ... Read More

C++ Program to Find Factorial of a Number using Recursion

Arjun Thakur
Updated on 24-Jun-2020 09:42:22

15K+ 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

C++ Program to Find Factorial of a Number using Iteration

Nishu Kumari
Updated on 15-May-2025 19:46:02

4K+ Views

In this article, we'll show you how to write a C++ program to find the factorial of a number using an iterative approach. The factorial of a number is the result of multiplying all the positive integers from 1 to that number. It is written as n! and is commonly used in mathematics and programming. Let's understand this with a few examples: //Example 1 Input: 5 The factorial of 5 is: 5 * 4 * 3 * 2 * 1 = 120 Output: 120 //Example 2 Input: 6 The factorial of 6 is: 6 * 5 * 4 ... Read More

C++ Program to Find the Frequency of a Character in a String

Nishu Kumari
Updated on 19-Aug-2025 17:13:23

18K+ Views

A string is a sequence of characters like letters, numbers, symbols, or anything enclosed in double quotes (e.g., "Hello"). Our goal is to find the frequency of a character in a given string, which means counting how many times that specific character appears in the string. Let's look at an example to understand the problem clearly- //Example 1 Input: String: "Tutorialspoint" Character to check: 't' Output: The character 't' appears 3 times in the string. //Example 2 Input: String: "Welcome to Tutorialspoint" Character to check: 'o' Output: The character 'o' appears 4 times in the string. ... Read More

C++ Program to convert Decimal Numbers to Octal

Nishu Kumari
Updated on 20-May-2025 20:09:56

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. In this article, we will write a C++ program that converts a decimal number into an octal number. Examples of decimal numbers and their corresponding octal numbers are as follows. ... Read More

C++ Program to Copy Strings

Nishu Kumari
Updated on 15-May-2025 19:46:46

4K+ Views

In this article, we'll show how to write a C++ program to copy strings. A string in C++ is a sequence of characters, such as letters, numbers, symbols, or anything enclosed in double quotes (e.g., "Hello"). Copying a string means transferring all characters from one string to another or making an exact copy. For example, here's how copying works: Input: "Learning C++ is fun!" Output: "Learning C++ is fun!" (This is the copied string) We can copy a string in C++ using the following methods: Using strcpy() Function ... Read More

realpath_cache_size() function in PHP

karthikeya Boyini
Updated on 24-Jun-2020 09:31:33

118 Views

The realpath_cache_size() function returns realpath cache size i.e. the amount of memory.Syntaxrealpath_cache_size()ParametersNAReturnThe realpath_cache_size() function returns the amount of memory realpath cache is using.Example Live DemoOutput362

Advertisements