datatypes in C++

Just like other languages, all variables have a datatypes in C++  ,name, size and value. The detailed info of the datatypes of C++ is: Type Name Bytes Other Names Range of...

C++ inheritance

lets have a look at the below example: // C++ inheritance #include<iostream> using namespace std;   class Point { protected:     int x,y; public:     Point(int ,int);     void display(void); };   Point::Point(int a,int b) {     x=a;     y=b; }   void Point::display(void) {      cout<<"point = "; }   class Circle : public Point {     double radius; public:     Circle(int ,int ,double );     void display(void); };   Circle::Circle(int a,int b,double c):Point(a,b) {     radius = c; }   void Circle :: display(void) {     Point::display();     cout<<" and radius = "<<radius; }   int main(void) {     Circle c(3,4,2.5);     c.display();     cout<<endl;     return 0; } In the above we took a class “point” in which we defined its attributes (its data members and member functions), then we inherited(derived) the...

Creating Overloaded operator in C++ with example

As we know The variables of primitive data types can perform a number of different operations (functions) using operators like (+, - , /, *)/ For Example: a + b * c...

Array Elements summation in C++

Array elements summation is a famous task for programmers, as We can take the array elements from the user also, Similarly we can compute sum of element of array also. Here...

Pointers in C++

Pointers in C++ are the variables that contain memory addresses as their values. Normally, a variable directly contains a specific value. A pointer contains the memory address of a variable that,...

Control structures in C++

Control structures in C++ also called the decision makers. In C++ We have control structures which are helpful in programs which needs a little bit concept of decision making between different...

Area and Perimeter of rectangle in C++

Area and Perimeter both are the mathematical terms used with rectangle, area is the length multiplied by width while perimeter is the length of all sides of the rectangle. Now how...

Binomial Coefficients in C++

How we implement a logic to find out the binomial coefficients of an entered number by the user in C++?. Look at the below code: # include <iostream> ...

Fibonacci Number program in C++ using Recursion

This program shows A Fibonacci Sequence starting from a user's entered number, the approach used here is recursive.Have a look at the code: //febonacci using recursion ...

Comparing two Numbers in C++

Here we are going to look at an example which is able of comparing two numbers in C++. In future we might need a simple code for comparing two integers to...