C++ Language
#include<iostream.h>
#include<conio.h>
class student
{
private:
int m1,m2,m3,m4,i,sum;
float per;
public:
inline void getdata()
{
cout<<"Enter the Marks of Student - ";
cin>>m1;
cout<<"Enter the Marks of Student - ";
cin>>m2;
cout<<"Enter the Marks of Student - ";
cin>>m3;
cout<<"Enter the Marks of Student - ";
cin>>m4;
}
inline void display()
{
sum=0;
cout<<"Marks of Student ----->"<<endl;
sum=sum+m1+m2+m3+m4;
cout<<"Sum of Marks - "<<sum<<endl;
per=sum/4;
cout<<"Percentage of Student - "<<per<<"%"<<endl;
if(per>=80 && per<=90)
cout<<"**First Position**"<<endl;
else if(per>=70 && per<=80)
cout<<"**Second Position**"<<endl;
else if(per>=60 && per<=70)
cout<<"**Third Position**"<<endl;
else if(per>=50 && per<=60)
cout<<"**Fourth Position**"<<endl;
}
};
void main()
{
clrscr();
student obj;
obj.getdata();
obj.display();
getch();
}
/*OUTPUT*/
Enter the Marks of Student - 90
Enter the Marks of Student - 80
Enter the Marks of Student - 88
Enter the Marks of Student - 79
Marks of Student ----->
Sum of Marks - 337
Percentage of Student - 84%
**First Position**