Prog 19 : write
a program to read and write student data using class
#include<iostream .h>
#include<conio.h>
class student
{
private :
int no;
char name[25];
float per;
public:
void getdata();
void putdata()
{
cout<<"\n no
="<<no;
cout<<"\n name="<< name;
cout<<"\n per
="<<per;
}
};
void student::getdata()
{
cout<<"\n enter
no";
cin>>no;
cout<<"\n enter
name";
cin>>name;
cout<<"\n enter per";
cin>>per;
cout<<"\n enter per";
cin>>per;
}
void main()
{
clrscr();
student s;
s.getdata();
s.putdata();
getch();
student s;
s.getdata();
s.putdata();
getch();
}
Output:
enter no 1
enter name kalpesh
enter per
70
no =1
name=kalpesh
per =70
No comments:
Post a Comment