SHARE
TWEET

Untitled

a guest Jan 21st, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. using namespace std;
  3. class student
  4. {
  5. private:
  6. int rollno, marks[6], per ;
  7. char name[20], grade;
  8. public:
  9. void getdata(){
  10.         cout<<"Enter rollno:" <<endl;
  11.     cin>>rollno;
  12.         cout<<"Enter name:" <<endl;
  13.     cin>>name;
  14.         cout<<"Enter 6 Subjects Marks in values of out of 100:" <<endl;
  15.         for(int i=0; i<6;i++){
  16.             cin>>marks[i];
  17.         }
  18. }
  19. void percentage(){
  20.     per=0;
  21.     for(int i=0 ; i<6; i++){
  22.          per=per+marks[i];
  23.     }
  24.     cout<<"Total percentage :"<<(float)per/100;
  25. }
  26. void grades(){
  27.     if(per<30){
  28.         cout<<" U failed!"<<" "<<"# F - Grade"<<endl;
  29.     }
  30.     else if(per< 45){
  31.         cout<<" Just passed!"<<" "<<"# D - Grade"<<endl;
  32.     }
  33.     else if(per< 60){
  34.         cout<<" Average Score!"<<" "<<"# C - Grade"<<endl;
  35.     }
  36.     else if(per<80){
  37.         cout<<" Good Score!"<< " "<<"# B- Grde"<<endl;
  38.     }
  39.     else{
  40.         cout<<" Awesome Score!"<<" "<<"# A- Grade";
  41.     }
  42.  
  43. }
  44. };
  45. int main(){
  46.     student s1;
  47.     s1.getdata();
  48.     s1.percentage();
  49.     s1.grades();
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top