CPP

//-------------------Program of Bank Account----------------------
#include
#include
class bankaccount
{
      int records[5]={"111","222","333","444","555"};
      int acc_no;
      float bal;
      char acc_type[10];
      char name[10];
public:
      void create();
      void deposit();
      void withdraw();
      void display();

};
void bankaccount::create()
{
//cout<<"\nEnter the number of records you want to create:";
//cin>>records;
for(int i=0;i<5;i++)
{
cout<<"\nEnter Account Number:";
cin>>acc_no;
cout<<"\nEnter Name:";
cin>>name;
cout<<"\nEnter the account type which you want to create:";
cin>>acc_type;
//cout<<"Account is created";
}

}
void bankaccount::deposit()
{
int accno;
float amt,bal=500;
cout<<"\nEnter the account number on which you want to deposit:";
cin>>accno;
for(int i=0;i<4;i++)
{

if(records[i]==accno)
{
cout<<"\nEnter the amount to be deposited:";
cin>>amt;
bal=bal+amt;
cout<<"\nYour Current Balance is:"<




//-----Programme Constructor Oveloading----------------
#include
#include
#include
#include
#include
#include

class Figure
{
    float rs,side1,side2,side3;
    char shape[10];
  public:
    Figure(float r)
    {
        rs=r;
        side1=0;
        side2=0;
        side3=0;
        strcpy(shape,"Circle");
    }
    Figure(float s1,float s2)
    {
        side1=s1;
        side2=s2;
        side3=rs=0.0;
        strcpy(shape,"Rectangle");
    }
    Figure(float s1,float s2,float s3)
    {
        side1=s1;
        side2=s2;
        side3=s3;
        rs=0.0;
        strcpy(shape,"Triangle");
    }
    void area()
    {
        float area,s;
        if(rs==0.0)
        {
            if(side3==0.0)
                area=side1*side2;
            else
            {
                s=(side1+side2+side3)/2.0;
                area=sqrt(s*(s-side1)*(s-side2)*(s-side3));
            }
        }
        else
            area=3.14*rs*rs;
        cout<<"\nArea of "<    }
};

void main()
{
    int ch,gd,gm;
    gm=0;
    gd=DETECT;
    float r,s1,s2,s3,cir,peri;
    clrscr();
    initgraph(&gd,&gm,"c:\\TC\\BGI");
    cout<<"\n\n----- CONSTRUCTOR OVERLOADING -----";
    do
    {
        cout<<"\n1.Circle\n2.Rectangle\n3.Triangle\n4.Exit:\n";
        cout<<"\n Enter your choice  :";
        cin>>ch;
        switch(ch)
        {
            case 1:
                cout<<"\n 1.Area\n 2.Circumferance \n";
                cout<<"\n Enter your choice  :";
                cin>>ch;
                switch(ch)
                {
                    case 1:
                        cout<<"\n Enter radious of circle  :";
                        cin>>r;
                        Figure c(r);
                        c.area();
                        circle(400,100,r);
                        break;
                     case 2:
                        cout<<"\n Enter radious of circle  :";
                        cin>>r;
                        cir=(2*3.14*r);
                        cout<<"\n Circumferance   :"<                        break;
                }
                break;
            case 2:
                cout<<"\n 1.Area\n 2.Perimeter:\n";
                cout<<"\n Enter your choice  :";
                cin>>ch;
                switch(ch)
                {
                    case 1:
                        cout<<"\n Enter 2 sides of Rectangle  :";
                        cin>>s1>>s2;
                        Figure r(s1,s2);
                        r.area();
                        rectangle(400,s1,800,s2);
                        break;
                    case 2:
                        cout<<"\n Enter 2 sides of Rectangle  ;";
                        cin>>s1>>s2;
                        peri=(s1*2)+(s2*2);
                        cout<<"\n Perimeter   :"<                        break;
                }
                break;
            case 3:
                cout<<"\n 1.Area\n 2.Perimeter:\n";
                cout<<"\n Enter your choice   :";
                cin>>ch;
                switch(ch)
                {
                    case 1:
                        cout<<"\n Enter 3 sides of Triangle  :";
                        cin>>s1>>s2>>s3;
                        Figure t(s1,s2,s3);
                        t.area();
                        line(500,s1,350,s2);
                        line(500,s1,450,s3);
                        line(400,s2,450,s3);
                        break;
                    case 2:
                        cout<<"\n Enter 3 sides of Rectangle  ;";
                        cin>>s1>>s2>>s3;
                        peri=(s1+s2+s3);
                        cout<<"\n Perimeter   :"<                        break;
                }
                break;
            case 4:
                exit(0);
                break;
            default:
                cout<<"\nInvalid Choice:\n";
                break;
        }
    }while(ch!=4);
    getch();
}



//--------------Programme for Function Overloading-----------------

#include
#include
#include
#include
#include
#include

class Figure
{
    float rs,side1,side2,side3;
    char shape[10];
 public:
    void draw(float r)
    {
        rs=r;
        side1=0;
        side2=0;
        side3=0;
        strcpy(shape,"Circle");
    }
    void draw(float s1,float s2)
    {
        side1=s1;
        side2=s2;
        side3=rs=0.0;
        strcpy(shape,"Rectangle");
    }
    void draw(float s1,float s2,float s3)
    {
        side1=s1;
        side2=s2;
        side3=s3;
        rs=0.0;
        strcpy(shape,"Triangle");
    }
    void area()
    {
        float area,s;
        if(rs==0.0)
        {
            if(side3==0.0)
                area=side1*side2;
            else
            {
                s=(side1+side2+side3)/2.0;
                area=sqrt(s*(s-side1)*(s-side2)*(s-side3));
            }
        }
        else
            area=3.14*rs*rs;
        cout<<"\nArea of "<    }
};

void main()
{
    int ch,gd,gm;
    gm=0;
    gd=DETECT;
    float ra,s1,s2,s3,peri;
    Figure c,r,t;
    clrscr();
    initgraph(&gd,&gm,"c:\\TC\\BGI");
    cout<<"\n\n----- FUNCTION OVERLOADING -----";

    do
    {
        cout<<"\n 1.Circle\n 2.Rectangle\n 3.Triangle\n 4.Exit\n";
        cout<<"\n Enter your choice :";
        cin>>ch;
        switch(ch)
        {
            case 1:
                cout<<"\n 1.Area\n 2.Circumferance\n";
                cout<<"\n Enter your choice  :";
                cin>>ch;
                switch(ch)
                {
                    case 1:
                        cout<<"\n Enter radius of circle   :";
                        cin>>ra;
                        c.draw(ra);
                        c.area();
                        circle(500,400,ra);
                        break;
                    case 2:
                        cout<<"\n Enter radious of Circle  :";
                        cin>>ra;
                        peri=(2*3.14*ra);
                        cout<<"\n Circumferance   :"<                        break;
                }
                break;
            case 2:
                cout<<"\n 1.Area\n 2.Perimeter:\n";
                cout<<"\n Enter your choice:";
                cin>>ch;
                switch(ch)
                {
                    case 1:
                        cout<<"\n Enter 2 sides of rectangle:\n";
                        cin>>s1>>s2;
                        r.draw(s1,s2);
                        r.area();
                        rectangle(300,s1,400,s2);
                        break;
                    case 2:
                        cout<<"\n Enter 2 sides of Rectangle  ;";
                        cin>>s1>>s2;
                        peri=(s1*2)+(s2*2);
                        cout<<"\n Perimeter   :"<                        break;
                }
                break;
            case 3:
                cout<<"\n 1.Area\n 2.Perimeter:\n";
                cout<<"\n Enter your choice:";
                cin>>ch;
                switch(ch)
                {
                    case 1:
                        cout<<"\n Enter 3 sides of triangle:\n";
                        cin>>s1>>s2>>s3;
                        t.draw(s1,s2,s3);
                        t.area();
                        line(400,s1,250,s2);
                        line(400,s1,350,s3);
                        line(300,s2,350,s3);
                        break;
                    case 2:
                        cout<<"\n Enter 2 sides of tirangle  ;";
                        cin>>s1>>s2;
                        peri=(s1+s2+s3);
                        cout<<"\n Perimeter   :"<                        break;
                }
                break;
            case 4:
                exit(0);
                break;
            default:
                cout<<"\nInvalid Choice:\n";
                break;
        }
    }while(ch!=4);
    getch();
}



//------------------Programme for Library-----------------


#include
#include
class lib
 {
  private:
  char name[20];
  int eng_book,hindi_book,other_book,total_book;

  public:
  void readdata()
   {
   cout<<"\n Enter name of Library:";
   cin>>name;
   cout<<"\nEnter the no.s of English bookes:";
   cin>>eng_book;
   cout<<"\nEnter the no.s of Hindi bookes:";
   cin>>hindi_book;
   cout<<"\nEnter the no.s of other bookes:";
   cin>>other_book;
   }

   void compute()
   {
   total_book=eng_book+hindi_book+other_book;
   cout<<"\nTotal no.of bookes:"<


//------Program of MatrixOperation using the concept of FRIEND function and FRIEND class

#include
#include
#include
class matrix;
class mat
{
private:
int i,j,k;
int a[3][3],b[3][3],c[3][3],d[3][3];
int f[3][3],g[3][3];
public:
void accept();
friend void addition(mat obj);
friend void substraction(mat obj);
friend void multiplication(mat obj);
friend void transpose(mat obj);
friend class matrix;
};
class matrix
{
public:
void show(mat obj1)
{
cout<<"\nYour Entered Matrix is:\n";
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
cout<<"\t|"<