Tag Archives: C++ Tutorial

C++ for Beginners: C++ Program to Find Size of int, float, double and char in Your System

(C++ programming Example for Beginners) C++ Program to Find Size of int, float, double and char in Your System his program declares 4 variables of type int, float, double and char. Then, the size of each variable is evaluated using sizeof operator. To find the size of variable,  sizeof operator is used. sizeof(dataType); Example: Find Size …

C++ for Beginners: C++ Program to Find Quotient and Remainder

(C++ programming Example for Beginners) C++ Program to Find Quotient and Remainder In this example, you will learn to find the quotient and remainder of a given dividend and divisor. In this program, user is asked to enter two integers (divisor and dividend) and computes the quotient and remainder. To compute quotient and remainder, both …

C++ for Beginners: C++ Program to Add Two Numbers

(C++ programming Example for Beginners) C++ Program to Add Two Numbers In this program, user is asked to enter two integers. Then, the sum of those two integers is stored in a variable and displayed on the screen. Primary tabs Example: Program to Add Two Integers #include <iostream> using namespace std; int main(){ int firstNumber, …

C++ for Beginners: C++ Program to Print Number Entered by User

(C++ programming Example for Beginners) C++ Program to Print Number Entered by User In this example, you’ll learn to print the number entered by a user using C++ cout statement. Example: Print Number Entered by User #include <iostream> using namespace std; int main(){ int number; cout << “Enter an integer: “; cin >> number; cout …

C++ for Beginners: C++ Polymorphism

(C++ programming Example for Beginners) C++ Polymorphism In this tutorial, we will learn about polymorphism in C++ with the help of examples. Polymorphism is an important concept of object-oriented programming. It simply means more than one form. That is, the same entity (function or operator) behaves differently in different scenarios. For example, The + operator in C++ …

C++ for Beginners: C++ friend Function and friend Classes

(C++ programming Example for Beginners) C++ friend Function and friend Classes In this tutorial, we will learn to create friend functions and friend classes in C++ with the help of examples. Data hiding is a fundamental concept of object-oriented programming. It restricts the access of private members from outside of the class. Similarly, protected members …

C++ for Beginners: C++ Function Overriding

(C++ programming Example for Beginners) C++ Function Overriding In this tutorial, we will learn about function overriding in C++ with the help of examples. As we know, inheritance is a feature of OOP that allows us to create derived classes from a base class. The derived classes inherit features of the base class. Suppose, the same function …

C++ for Beginners: Public, Protected and Private Inheritance in C++ Programming

(C++ programming Example for Beginners) Public, Protected and Private Inheritance in C++ Programming In this tutorial, we will learn to use public, protected and private inheritance in C++ with the help of examples. In C++ inheritance, we can derive a child class from the base class in different access modes. For example, class Base { …. …

C++ for Beginners: C++ Inheritance

(C++ programming Example for Beginners) C++ Inheritance In this tutorial, we will learn about inheritance in C++ with the help of examples. Inheritance is one of the key features of Object-oriented programming in C++. It allows us to create a new class (derived class) from an existing class (base class). The derived class inherits the features from …