Startertutorials Blog
Tutorials and articles related to programming, computer science, technology and others.
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.
Home » Programming » C++ Programming » Page 3

Cpp program to illustrate the use of constructor and destructor

Suryateja Pericherla Categories: Classes and Objects. No Comments on Cpp program to illustrate the use of constructor and destructor

In this article we will learn to implement a Cpp program to illustrate the use of constructor and destructor. A C++ program is provided below to demonstrate the use of constructor and destructors. Program is as follows: #include <iostream> using namespace std; class Distance { private: int feet; int inches; public: Distance() {} Distance(int f, […]

Read the rest of this entry »

CPP program for illustrating function overloading in adding the distance between objects

Suryateja Pericherla Categories: Classes and Objects. No Comments on CPP program for illustrating function overloading in adding the distance between objects

In this article we will learn to implement a CPP program for illustrating function overloading in adding the distance between objects. A C++ program is provided below for adding the distance between objects using function overloading.   We create a distance class with the following: feet and inches as data members member function to input […]

Read the rest of this entry »

Cpp program to create objects of distance class and add them

Suryateja Pericherla Categories: Classes and Objects. 4 Comments on Cpp program to create objects of distance class and add them

In this article we will learn to implement a Cpp program to create objects of distance class and add them. A C++ program is provided below that adds objects of distance class.   We create a distance class with the following: feet and inches as data members member function to input distance member function to […]

Read the rest of this entry »

Cpp program to illustrate function overloading by adding two numbers

Suryateja Pericherla Categories: Functions. No Comments on Cpp program to illustrate function overloading by adding two numbers

In this article we will learn to implement a Cpp program to illustrate function overloading by adding two numbers. A C++ program is provided below to demonstrate function overloading by adding different types of numbers.   Program is as follows: #include <iostream> using namespace std; int sum(int a, int b) { return a+b; } float […]

Read the rest of this entry »

CPP program to demonstrate the use of default arguments

Suryateja Pericherla Categories: Functions. No Comments on CPP program to demonstrate the use of default arguments

In this article we will look at implementing a CPP program to demonstrate the use of default arguments. A C++ program is provided below to illustrate the use of default arguments for simple interest function. Program is as follows: #include <iostream> using namespace std; float si(int p, int n, int r=5) { return (p*n*r)/100; } […]

Read the rest of this entry »

CPP program to illustrate function overloading

Suryateja Pericherla Categories: Functions. No Comments on CPP program to illustrate function overloading

In this article we will learn to implement a CPP program to illustrate function overloading. A C++ program is provided below to demonstrate function overloading using 2 overloading functions for power.   Program is as follows: #include <iostream> #include <cmath> using namespace std; int power(int x) { return pow(x, 2); } int power(int x, int […]

Read the rest of this entry »

CPP program to illustrate inline functions

Suryateja Pericherla Categories: Functions. No Comments on CPP program to illustrate inline functions

In this article we will learn to implement a CPP program to illustrate inline functions. A C++ program is provided below for demonstrating inline functions.   Program is as follows: #include <iostream> using namespace std; inline void swap(int &x, int &y) { int temp = x; x = y; y = temp; } int main() […]

Read the rest of this entry »

CPP program to illustrate enumerations

Suryateja Pericherla Categories: Others. No Comments on CPP program to illustrate enumerations

In this article we will learn to implement a CPP program to illustrate enumerations. A C++ program is provided below to demonstrate enumerations.   Program is as follows: #include <iostream> using namespace std; int main() { enum direction{left='l', right='r'}; char ch; cout<<"Enter direction (as character): "; cin>>ch; direction d = (direction) ch; switch(d) { case […]

Read the rest of this entry »

CPP program to illustrate scope resolution operator

Suryateja Pericherla Categories: Others. 2 Comments on CPP program to illustrate scope resolution operator

In this article we will learn to implement a CPP program to illustrate scope resolution new and delete operators. A C++ program is given below to demonstrate scope resolution operator, new operator and delete operators.   Program is as follows: #include <iostream> using namespace std; int x = 20; int main() { int x = […]

Read the rest of this entry »
Facebook
Twitter
Pinterest
Youtube
Instagram
Blogarama - Blog Directory