Thursday, 11 September 2014

C++ Programs

1.How to create a class and its object

 

#include<iostream.h>
#include<conio.h>

class add 
{  
 int a,b,c;   
 public :   
 void get()  
  {    
   cout<<"enter  two no";    
   cin>>a>>b;  
  }    
 void show() 
  { 
    c=a+b;

    cout<<"addition is:-"<<c;
  }
};

void main()
  {

   add a; 
   clrscr();
   a.get();
   a.show();
   getch();
  }
 

No comments:

Post a Comment