


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<iostream.h> #include<conio.h> class student { public: int reg_no; //float per; char name[20]; void getdata() { cout<<"Enter Reg_No :- \t"; cin>>reg_no; cout<<"Enter Name :- \t"; cin>>name; } }; class marks : public student { public: int m1,m2,m3,tot; float per; void getmarks() { getdata(); cout<<"Enter Marks 1 :- \t"; cin>>m1; cout<<"Enter Marks 2 :- \t"; cin>>m2; cout<<"Enter Marks 3 :- \t"; cin>>m3; tot=m1+m2+m3; return tot; } void display() { getmarks(); cout<<"Roll Not \t Name \t Marks1 \t marks2 \t Marks3 \t Total \t Percentage"; cout<<rno<<"\t"<<name<<"\t"<<m1<<"\t"<<m2<<"\t"<<m3<<"\t"<<tot<<"\t"<< per; } }; void main() { student std; std.getmarks(); std.display(); }
#include
int main( ) { Adder a; a.addNum( 10 ); a.addNum( 20 ); a.addNum( 30 ); cout << "Total " << a.getTotal() <<endl; return 0 ; }
#include