CPP

No Image

Bubble Sort in C++ Using Class

In this post,  bubble sort is written in C++ using class. #include<iostream> using namespace std; class BubbleSort { int a[20]; public: int *bubblesort(int *, int); }; int* BubbleSort :: bubblesort( int a[], int n) {…

Read More

No Image

Templates in C++

Templates are used to support generic programming  in C++, what happens when you need a function of a class that takes its argument  as float as well as integer. You have to declare and define…


No Image

Polymorphism Feature in C++

Polymorphism Feature in C++ Polymorphism means single name but multiple formats and this is one of the crucial features of C++. Furthermore, when there are multiple formats of a single function then choosing an appropriate…


No Image

Inheritance in C++

Inheritance in C++Inheritance is a very important feature of object-oriented programming approach. Further, which provides the mechanism of reusability of classes. Moreover, it is very important to reuse classes which are tested. And this idea…


No Image

Sum of Natural Numbers in C++

Sum of Natural Numbers in C++ Program Description- In this program, a class Sum is declared. Which has two public variables n and i and a public function sum_of_n() which takes an integer argument( user…


No Image

Factorial in CPP Using Class

Factorial in CPP Using Class Program Description- Program that calculates factorial in cpp of a natural number. Further, a class Fact is declared in which there are two public integer  variables  which are n and…


No Image

Add Two Numbers in CPP

Add Two Numbers in CPP #include<iostream> using namespace std; int main() { int x, y, sum; cout<<” Enter Two Numbers for Addition”<<endl; cin>>x>>y; sum = x + y; cout<< “Sum of Two Numbers is”<<“n”<<sum; return…