Back To C++ Classes
//program to demonstrate example of class student with array marks having 3 integer elements as a datamember of the class #include
#include
class student { int rollno; char name[20]; int clas; float marks[3]; public: void getdata(); void showdata(); }; void student::getdata() { int i; cout<<"\nenter rollno of student "; cin>>rollno; cout<<"\nenter name of student "; cin>>name; cout<<"\nenter class of student "; cin>>clas; for(i=0;i<3;i++) { cout<<"\nenter marks of student in subject "<
>marks[i]; } } void student::showdata() { int i; cout<<"\nrollno of student is "<