Tag Archives: C++ Tutorial

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

Hits: 866 (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 …

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

Hits: 15 (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 …

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

Hits: 28 (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 …

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

Hits: 9 (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 …

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

Hits: 9 (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 …

C++ for Beginners: C++ Program to Display Prime Numbers Between Two Intervals Using Functions

Hits: 4 (C++ programming Example for Beginners) C++ Program to Display Prime Numbers Between Two Intervals Using Functions Example to print all prime numbers between two numbers (entered by the user) by making a user-defined function. Example: Prime Numbers Between two Intervals #include <iostream> using namespace std; int checkPrimeNumber(int); int main(){ int n1, n2; bool …

C++ for Beginners: C++ Program to Make a Simple Calculator

Hits: 24 (C++ programming Example for Beginners) C++ Program to Make a Simple Calculator to Add, Subtract, Multiply or Divide Using switch…case Example to create a simple calculator to add, subtract, multiply and divide using switch and break statement. This program takes an arithmetic operator (+, -, *, /) and two operands from an user …

C++ for Beginners: C++ Programs To Create Pyramid and Pattern

Hits: 40 (C++ programming Example for Beginners) C++ Programs To Create Pyramid and Pattern Examples to print half pyramid, pyramid, inverted pyramid, Pascal’s Triangle and Floyd’s triangle in C++ Programming using control statements. Programs to print triangles using *, numbers and characters Example 1: Program to print half pyramid using * * * * * …

C++ for Beginners: C++ Program to Display Prime Numbers Between Two Intervals

Hits: 7 (C++ programming Example for Beginners) C++ Program to Display Prime Numbers Between Two Intervals Example to print all prime numbers between two numbers (entered by the user) in C++ Programming. This problem is solved using nested for loop and if…else statement.   Example #1: Display Prime Numbers Between two Intervals #include <iostream> using …

C++ for Beginners: C++ Program to Check Whether a Number is Palindrome or Not

Hits: 5 (C++ programming Example for Beginners) C++ Program to Check Whether a Number is Palindrome or Not This program reverses an integer (entered by the user) using while loop. Then, if statement is used to check whether the reversed number is equal to the original number or not. This program takes an integer from …

C++ for Beginners: C++ Program to Multiply two Numbers

Hits: 2 (C++ programming Example for Beginners) C++ Program to Multiply two Numbers In this program, user is asked to enter two numbers (floating point numbers). Then, the product of those two numbers is stored in a variable and displayed on the screen. C++Program to Multiply Two Numbers #include <iostream> using namespace std; int main(){ …

C++ for Beginners: Increment ++ and Decrement — Operator Overloading in C++ Programming

Hits: 7 (C++ programming Example for Beginners) Increment ++ and Decrement — Operator Overloading in C++ Programming In this example, you’ll learn to overload increment ++ and decrement — operators in C++. In this tutorial, increment ++ and decrements — operator are overloaded in best possible way, i.e., increase the value of a data member …