Here we have given you all the code of C++ Programming Lnaguage, which are best for BCA and IT Students. To view and copy the code just double tap on the programs topic given below.

Hello World Program in C++.

StudyMuch

#include <isotream.h>   //header file
#include <conio.h>   //header file
void main()
{
   clrscr();
// Clearing Screen for removing Garbage Value

   cout<<"Hello World"<<endl;
// cout is used to print on screen

   getch();
// For holding console window
}
Program to find Average of 5 numbers in C++.

StudyMuch

#include <isotream.h>
#include <conio.h>
void main()
{
int a, b, c, d, e, avg;
clrscr();

cout<<"Enter the 4 numbers."<<endl;
   cin>>a>>b>>c>>d>>e;

   avg=(a+b+c+d)/5;

   cout<<"The average of five numbers is "<<avg<<endl;
   getch(); }
Program to sum two numbers using Constructor.

StudyMuch

#include <isotream.h>
#include <conio.h>
class student
{
       public :
   int a, b, c ;

   student ()
{
   cout<<"Enter two numbers: "<<endl ;
   cin>>a>>b ;

   c = a + b ;
   cout<<" The sum of two numbers is: "<<c ;
}
};
   void main()
{
   clrscr();
   student();
   getch();
}
Program to find Factorial of a number using Function.

StudyMuch

#include <isotream.h>
#include <conio.h>
void fact()
{
int a, b, f=1;
clrscr();

   cout<<"Enter a number: "<<endl;
   cin>>a;

for (b=a ; b>0 ; b--)
f = f * b;

cout<<" Factorial of "<<a<<" is: "<<f;
}
void main()
{
   clrscr();
   fact();
   getch();
}
Program to Implement a class in C++.

StudyMuch

#include <isotream.h>
#include <conio.h>
class student   // Here 'student' is the name of class
{
   public:  // Access Specifier
   char a[10] ;
   int b ;

   void mydata (void);  // Function declaration inside class
} ;

void student :: mydata (void)   // Function Calling where ' :: ' is scope resolution operator
{
   cout<<"Enter your name: "<<endl ;
   cin>>a;

   cout<<"Enter your age: "<<endl ;
   cin>>b;

   cout<<"So your name is "<<a<<" and age is "<<b ;
}
void main()
{
   clrscr();
   student x ;  // Creating object(x) for class(student)
   x.mydata();  // Function Invoking using dot operator
   getch();
}
Program to implement Single Level Inheritance.

StudyMuch

#include <isotream.h>
#include <conio.h>

class A
{
   public:
   char name[10];
   int a;
   void student (void)
{
   cout<<"Enter your name: "<<endl;
   cin>>name;
}
};

class B : public A
{
   public:
   void age (void)
{
   cout<<"Enter your age: "<<endl;
   cin>>a;
}
};

void main()
{
 clrscr();
 B m;
// Creating object for class B
// As class B also contains public elements of class A

 m.student();
 m.age();
 getch();
}
Program to implement a Class using 2 member Function.

StudyMuch

#include <isotream.h>
#include <conio.h>
class student  // Here 'student' is the name of class
{
   public:  // Access Specifier
   char a[20];
   int b;
   void getdata (void);   // Function Declaration inside class
   void displaydata (void);   // Function Declaration inside class
};

void student :: getdata (void)   // Function Calling where ' :: ' is scope resolution operator
{
   cout<<"Enter your name: "<endl;
   cin>>a;
   cout<<"Enter your age: "<<endl;
   cin>>b;
}
void student :: displaydata (void)   //Function Calling
{
   cout<<"So, your name is "<<a<<endl;
   cout<<"So, your age is "<<b<<endl;
}
void main()
{
   clrscr();
   student x;   // Creating object(x) for class(student)
   x.getdata();   // Function Invoking using dot operator
   x.displaydata();
   getch();
}
Program of a Constructor in C++.

StudyMuch

#include <isotream.h>
#include <conio.h>
class student
{
    public :
    char a[10] ;
    int b;

student ()   // Constructor has same name as of class name
{
    cout<<"Enter your name: "<<endl ;
    cin>>a;

    cout<<"Enter your age: "<<endl ;
    cin>>b;
}

void mydata (void)  // Member Fuction Calling inside class
{
cout<<"So your name is "<<a<<" and age is "<<b ;
}
};
void main()
{
 clrscr();
 student x ;   // Object (x) is created for Function (mydata)
 x.mydata();   // Constructor is invoked automatically
 getch();
}
Program to find sum of 2 numbers using Constructor.

StudyMuch

#include <isotream.h>
#include <conio.h>
class student
{
public :
int a, b, c ;

student ()
{
   cout<<"Enter two numbers: "<<endl ;
   cin>>a>>b ;

   c = a + b ;
   cout<<"The sum of two numbers is: "<<c ;
}
};
void main()
{
   clrscr();
   student();
    getch();
}
Program to implement Inline Function.

StudyMuch

#include <isotream.h>
#include <conio.h>

inline float average (float a, float b)
{
  return ((a+b)/2);
}

inline int addition (int c, int d)
{
  return (c+d);
}

void main()
{
   clrscr();
   int x, y;

   cout<<"Enter two values: "<<endl;
   cin>>x>>y;

   cout<<"The average of the numbers is: "<<average (x, y)<<endl;

   cout<<"The addition of two numbers is: "<<addition (x, y)<<endl;

   getch();
}
Program to implement Function Overloading in C++.

StudyMuch

#include <isotream.h>
#include <conio.h>
void num (int a, int b)
{
   cout<<"The addition is: "<<a+b<<endl;
}

void num (float c, float d)   //Same function name, different data types
{
   cout<<"The division is: "<<c/d<<endl;
}

void main()
{
   int x, y;
   float w, z;
   clrscr();

   cout<<"Enter the numbers for addition: "<<endl;
   cin>>x>>y;

   cout<<"Enter the numbers for division: "<<endl;
   cin>>w>>z;

   num(x,y);
   num(w,z);
   getch();
}
Program to Implement Multiple Inheritance.

StudyMuch

#include <isotream.h>
#include <conio.h>

class A
{
public:
char name[10];
void student (void)
{
cout<<"Enter your name: "<<endl;
cin>>name;
}
};

class B
{
 public:
 int a;
 void age (void)
{
cout<<"Enter your age: "<<endl;
cin>>a;
}
};

class C : public B, public A
{
 public:
 void data (void)
{
 cout<<"So, your name is "<<name<<" and your age is "<<a<<endl;
}
};

void main()
{
clrscr();
   C x;
   x.student();
   x.age();
   x.data();
   getch();
}
Program to implement Multi-Level Inheritance.

StudyMuch

#include <isotream.h>
#include <conio.h>
class A
{
   public:
    int a;
   char name[10];
   void student (void)
{
   cout<<"Enter your name: "<<endl;
   cin>>name;
   }
};

class B : public A
{
   public:
   void marks (void)
   {
   cout<<"Enter your age: "<<endl;
   cin>>a;
   }
};

class C : public B
{
   public:
   void data (void)
   {
   cout<<"So, your name is: "<<name;
   cout<<" and age is: "<<a;
   }
};

void main()
{
   clrscr();
   C m;
// Creating object for class C as it contains all public elements of class A & B
   m.student();
   m.marks();
   m.data();
   getch();
}
Program ot implement Namespace in C++.

StudyMuch

Use CodeBlocks for this program

#include <isotream.h>
#include <conio.h>
using namespace std;

namespace first
{
void function (void)
   {
   cout<<"This is first function."<<endl;
   }
}

namespace second  // Different Namespace name
{
   void function (void)  // Same function name
   {
    cout<<"This is second function."<<endl;
   }
}

int main()
{
    first :: function();
    second :: function();
    return 0;
}
Program to adding two numbers using Function Template.

StudyMuch

#include <isotream.h>
#include <conio.h>

template <class BCA>
BCA sum (BCA n1, BCA n2)
{
    return (n1+n2);
}

class BCA
{
    public:
    int a, b;
    void mydata (void);
};
void BCA :: mydata (void)
{
    cout<<"Enter two numbers: "<< endl;
    cin>>a>>b;

    cout<<"The addition is: "<<sum(a, b);
}

void main()
{
    clrscr();
    BCA x;
    x.mydata ();
    getch();
}
Program to implement Operator Overloading.

StudyMuch

#include <isotream.h>
#include <conio.h>
class BCA
{
    public:
    int rollno;
    float age;
    char grade;

BCA (int rn, float ag, char g)
{
    rollno = rn;
    age = ag;
    grade = g;
}

void operator ++ (int)
{
    rollno = rollno + 1;
    age = age + 1;
    grade = grade + 1;
}
};

void main()
{
  clrscr();
  BCA obj(20, 5.0, 'A');
  cout<<"Before overloading, valuess's variables are: \n";
  cout<<obj.rollno<<endl<<obj.age<<endl<<obj.grade;
  obj++;

  cout<<"\n After overloading, values's of variables are: \n";
  cout<<obj.rollno<<endl<<obj.age<<endl<<obj.grade;
  getch();
}
Program to find teh Fibonacci Series Using Constructor.

StudyMuch

#include <isotream.h>
#include <conio.h>
class fibonacci
{
   public:
   int a, b, x, y, z;

fibonacci ()
{
 x= 0;
 y= 1;
 cout<<"Enter a positive integer: "<<endl;
 cin>>a;

cout<<"The Fibonacci Series is: "<<endl;
for ( b=1; b<=a; ++b)
{
    cout<<x<<"\t";
    z = x + y;
    x = y;
    y = z;
}
}
};

void main()
{
   clrscr();
   fibonacci x;
   getch();
}
Program for finding greatest numbers between two numbers using Function Template.

StudyMuch

#include <isotream.h>
#include <conio.h>
template <class BCA>

BCA large (BCA n1, BCA n2)
{
   return (n1>n2)?n1:n2;
}

class BCA
{
   public:
   int a, b;
   void mydata (void);
};

void BCA :: mydata (void)
{
   cout<<"Enter two numbers: "<<endl;
   cin>>a>>b;

   cout<<"The larger numbers is: "<<large(a, b);
}

void main()
{
   clrscr();
   BCA x;
   x.mydata ();
   getch();
}