



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




#include
cout<<"\n\nRoll:"<<roll_no; cout<<"\n\nName:"<<name; cout<<"\n\nDate of birth:"<<dob; cout<<"\n\nDepartment:"<<dept_name; cout<<"\n\nCollege:"<<college; } class exam:virtual public student { protected: int marks[5]; public: void get_marks(); void print_marks(); }; void exam::get_marks() { cout<<"\nEnter Marks\n-------------------\n"; for(int i=0;i<6;i++) { while(true) { cout<<"\nSubject"<<i+1<<":"; cin>>marks[i]; if(marks[i]>=0&&marks[i]<=100) break; cout<<"Invalid marks given!!Enter proper marks..\n"; } }
int main() { int num,i; while(true) { cout<<"Enter number of students:"; cin>>num; if(num>0) break; cout<<"Invalid number given!!\n"; } result *stu=new result[num]; for(i=0;i<num;i++) { cout<<"\n\nEnter record for student no:"<<i+1<<"\n\n-------------------------
n-------------------------"; stu[i].get_info(); } cout<<"\n\nDisplaying results of students \n--------------------------------------------------------\n"; for(i=0;i<num;i++) { cout<<"\n\n\nRecord for student no:"<<i+1<<"\n\n------------------------\n------------------------"; stu[i].display(); } cout<<"\n"; delete[]stu; return 0; }