Write a program to declare class student having data members name and percentage. Write constructor to initialize these data members. Accept and display this data for one object.
#include<iostream.h>
#include<conio.h>
#include<string.h>
class student
{
char name[20];
float per;
public:
student(char n[],float p)
{
strcpy(name,n);
per=p;
}
void putdata()
{
cout<<"\n\t\t Name ::"<<name;
cout<<"\n\t\t Per ::"<<per;
}
};
void main()
{
student S("Sachin",78.00);
clrscr();
S.putdata();
getch();
}