Monday, 7 August 2017

//12-C Prog-11. write a programe to illustrate use of this pointer

//12-C Prog-11. write a programe to illustrate use of this pointer
#include<iostream.h>
#include<conio.h>
#include<stdio.h>

class sample
{
  int code;
  char str[20];
  public:
   void Insert();
   void Display();
};
void sample :: Insert()
{
  cout<<"\n Enter the code";
  cin>>this->code;
  cout<<"\n Enter string ";
  gets(this->str);
}
void sample::Display()
{
  cout<<"\n code="<<this->code;
  cout<<"\n string="<<this->str;
}

void main()
{
   clrscr();
   sample o;
   o.Insert();
   o.Display();
   getch();
}

No comments:

Post a Comment