#include<iostream.h>
#include<stdio.h>
#include<conio.h>
class mca
{
private:
char *name,*t;
int rn;
float age;
public:
mca()
{
name=new char[20];
//rn=new int;
//age=new float[4];
}
void getdata()
{
name=t;
cout<<"\nenter the student name,rn,age ";
gets(name);
cin>>rn;
cin>>age;
}
void display()
{
cout<<"\nthe student name "<<name<<" roll number "<<rn<<" age "<<age;
}
~mca()
{
delete []name;
}
};
void main()
{
clrscr();
mca *ptr=new mca;
mca *ptr1=new mca;
ptr=ptr1;
(*ptr).getdata();
ptr->display();
getch();
//delete []ptr;
}
#include<stdio.h>
#include<conio.h>
class mca
{
private:
char *name,*t;
int rn;
float age;
public:
mca()
{
name=new char[20];
//rn=new int;
//age=new float[4];
}
void getdata()
{
name=t;
cout<<"\nenter the student name,rn,age ";
gets(name);
cin>>rn;
cin>>age;
}
void display()
{
cout<<"\nthe student name "<<name<<" roll number "<<rn<<" age "<<age;
}
~mca()
{
delete []name;
}
};
void main()
{
clrscr();
mca *ptr=new mca;
mca *ptr1=new mca;
ptr=ptr1;
(*ptr).getdata();
ptr->display();
getch();
//delete []ptr;
}
No comments:
Post a Comment