#include<iostream>
using namespace std;
class marks{
private:
int mark1;
int mark2;
int mark3;
public:
void set_marks(){
cout<<"Enter mark 1: ";
cin>>mark1;
cout<<"Enter mark 2: ";
cin>>mark2;
cout<<"Enter mark 3: ";
cin>>mark3;
}
int sum(){
return mark1+mark2+mark3;
}
float avg(){
return (float)( sum())/3.0;
}
};
int main() {
int num;
marks mark;
mark.set_marks();
cout<<"Sum: "<<mark.sum()<<"\n";
cout<<"Avg: "<<mark.avg()<<"\n";
cin>>num;
return 0;
}
Comments
Leave a comment