You are on page 1of 2

#include<iostream.

h>

class student {

int rno;

char sname[21];

float eng,maths,phy,chem,bio;

float total;

float ctotal()

float tot=eng+maths+phy+chem+bio; return tot; } public: void takedata();

void showdata();

};

void student::takedata()

cout<<"\n enter name(max 20 char):";

cin.getline(sname,21);

cout<<"\n Enter rollno:";

cin>>rno;

cout<<"\n Marks\n";

cout<<"English:";

cin>>eng;

cout<<"Maths:";

cin>>maths;

cout<<"Physics:";

cin>>phy;

cout<<"Chemistry:";
cin>>chem;

cout<<"Biology:";

cin>>bio;

cout<<endl;

total=ctotal();

You might also like