Menu

Custom Search

C++ lab Program 8

#include
#include
class student
{
char name[20];
int roll;
int marks[3];
public: void getdata();
void display();
};
void student::getdata()
{ cout<<"Enter name:";
cin>>name;
cout<<"Enter roll no:";
cin>>roll;
cout<<"Enter marks in three subjects:";
cin>>marks[1]>>marks[2]>>marks[3];
}
void student::display()
{
cout <<"Name:"< cout<<"Roll NO:"<< roll< cout<<"Marks in three subjects:"< float x=(marks[1]+marks[2]+marks[3])/3;
cout<}
void main()
{ clrscr();
student s;
s.getdata();
s.display();
getch();
}

No comments:

Post a Comment