1


#include <iostream>
#include <string.h>
using namespace std;
const int SIZE=30;
class Student
{
private:
    int admno;
    char sname[SIZE];
    float eng;
    float maths;
    float phy;
    float total;

float ctotal(float Meng,float Mmaths,float Mphy)
{
total=Meng+Mmaths+Mphy;
return total;
}


public:
Student():total(0),eng(0),maths(0),phy(0)
{
strcpy(sname,"");
}

void getdata()
{
cout<<"Please Enter Admission number , Student name, And Marks"<<endl;
cin>>admno;
cin>>sname;
cin>>eng;
cin>>maths;
cin>>phy;
total=ctotal(eng,maths,phy);
}
void displaydata()
{
cout<<endl<<endl<<admno<<endl;
cout<<"Student Name is = "<<sname<<endl;
cout<<"Student English Marks is = "<<eng<<endl;
cout<<"Student Maths Marks is = "<<maths<<endl;
cout<<"Student Physics Marks is = "<<phy<<endl;
cout<<"Student Total Marks is = "<<total<<endl;
}
};


int main (void)

{
Student s1;
s1.getdata();
s1.displaydata();
}

Post a Comment

  1. Good man thanks for sharing. (Y)

    ReplyDelete

 
Top