Tag Archives: C++ Tutorial

C++ for Beginners: C++ Program to Add Two Matrix Using Multi-dimensional Arrays

(C++ programming Example for Beginners) C++ Program to Add Two Matrix Using Multi-dimensional Arrays This program takes two matrices of order r*c and stores it in two-dimensional array. Then, the program adds these two matrices and displays it on the screen. In this program, user is asked to entered the number of rows r and columns c. The …

C++ for Beginners: C++ Program to Calculate Standard Deviation

(C++ programming Example for Beginners) C++ Program to Calculate Standard Deviation This program calculates the standard deviation of 10 data using arrays. This program calculates the standard deviation of a individual series using arrays. Visit this page to learn about Standard Deviation. To calculate the standard deviation, calculateSD() function is created. The array containing 10 elements is passed …

C++ for Beginners: C++ Program to Find Largest Element of an Array

(C++ programming Example for Beginners) C++ Program to Find Largest Element of an Array This program takes n number of element from user (where, n is specified by user) and stores data in an array. Then, this program displays the largest element of that array using loops. This program takes n number of element from user(where, n is specified …

C++ for Beginners: C++ Program to Calculate Average of Numbers Using Arrays

(C++ programming Example for Beginners) C++ Program to Calculate Average of Numbers Using Arrays This program takes n number of element from user (where, n is specified by user), stores data in an array and calculates the average of those numbers. Example: Calculate Average of Numbers Using Arrays #include <iostream> using namespace std; int main(){ …

C++ for Beginners: C++ Program to Calculate Power Using Recursion

(C++ programming Example for Beginners) C++ Program to Calculate Power Using Recursion This program calculates the power of a number using recursion where base and exponent is entered by the user. Example: Program to Computer Power Using Recursion #include <iostream> using namespace std; int calculatePower(int, int); int main(){ int base, powerRaised, result; cout << “Enter …

C++ for Beginners: C++ program to Reverse a Sentence Using Recursion

(C++ programming Example for Beginners) C++ program to Reverse a Sentence Using Recursion This program takes a sentence from user and reverses that sentence using recursion. This program does not use string to reverse the sentence or store the sentence.   Example: Reverse a sentence using recursion. #include <iostream> using namespace std; void reverse(const string& …

C++ for Beginners: C++ Program to Convert Octal Number to Decimal and vice-versa

(C++ programming Example for Beginners) C++ Program to Convert Octal Number to Decimal and vice-versa In this example, you will learn to convert octal number to decimal and decimal number to octal manually by creating a user-defined function. Example 1: Convert Octal Number to Decimal #include <iostream> #include <cmath> using namespace std; int octalToDecimal(int octalNumber); …

C++ for Beginners: C++ Program to Convert Binary Number to Decimal and vice-versa

(C++ programming Example for Beginners) C++ Program to Convert Binary Number to Decimal and vice-versa In this example, you will learn to convert binary number to decimal, and decimal number to binary manually by creating user-defined functions. Example 1: C++ Program to convert binary number to decimal #include <iostream> #include <cmath> using namespace std; int …

C++ for Beginners: C++ program to Calculate Factorial of a Number Using Recursion

(C++ programming Example for Beginners) C++ program to Calculate Factorial of a Number Using Recursion Example to find factorial of a non-negative integer (entered by the user) using recursion. This program takes a positive integer from user and calculates the factorial of that number. Suppose, user enters 6 then, Factorial will be equal to 1*2*3*4*5*6 …

C++ for Beginners: C++ program to Find Sum of Natural Numbers using Recursion

(C++ programming Example for Beginners) C++ program to Find Sum of Natural Numbers using Recursion Example to find the sum of natural numbers by using a recursive function. The positive numbers 1, 2, 3… are known as natural numbers. The program below takes a positive integer from the user and calculates the sum up to …