Program -
#include<iostream.h>
#include<conio.h>
class acc
{
private:
int rollno;
char name[12];
public:
void read();
void write();
};
void acc::read()
{
cout<<"\n
enter the rollno";
cin>>rollno;
cout<<"\n
enter the name";
cin>>name;
}
void acc
::write()
{
cout<<"\n
entered rollno is:"<<rollno;
cout<<"\n
entered name is:"<<name;
}
void main()
{
class acc a1;
a1.read();
a1.write();
getch();
}
Output :
enter the rollno5
enter the name sonally
entered rollno is:5
entered name is: sonally
0 comments:
Post a Comment