Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

NAME‌‌:‌‌-‌ ‌AYUSH‌‌ARVINDKUMAR‌‌RANA‌ 


ROLL‌‌NO.‌‌:‌‌-‌ ‌122‌ 
SEMESTER‌‌:‌‌-‌ ‌3 ‌ ‌
DIVISION‌‌:‌‌-‌ ‌B ‌ ‌
 ‌
 ‌
 ‌
Develop‌‌a‌‌program‌‌that‌‌contains‌‌class‌‌student‌‌having‌‌roll‌‌no‌‌and‌‌name‌‌as‌‌public‌‌members‌‌and‌‌ 
marks‌‌of‌‌three‌‌subjects‌‌as‌‌private‌‌members.‌‌Now‌‌define‌‌a‌‌private‌‌function‌‌to‌‌calculate‌‌the‌‌grade‌‌of‌‌ 
the‌‌marks‌‌as‌‌per‌‌the‌‌following‌‌criteria‌‌and‌‌define‌‌a‌‌public‌‌member‌‌function‌‌display‌‌that‌‌displays‌‌the‌‌ 
grade‌‌. ‌ ‌
 ‌
Criteria‌‌of‌‌Grading‌  ‌
91-100‌ ‌A1‌  ‌
81-90‌ ‌A ‌ ‌
71-80‌ ‌B1‌  ‌
61-70‌ ‌B ‌ ‌
51-60‌ ‌C1‌  ‌
41-50‌ ‌C ‌ ‌
Below‌‌40‌ ‌D(FAIL)‌  ‌
 ‌
On‌‌the‌‌output‌‌screen‌‌display‌‌Roll‌‌No,‌‌Name,‌‌Grades‌‌in‌‌three‌‌subjects.‌  ‌
 ‌
You‌‌may‌‌enhance‌‌the‌‌program‌‌by‌‌using‌‌features‌‌like‌‌arrays,‌‌subject‌‌names,‌‌function‌‌overloading‌‌etc.‌‌ 
Use‌‌of‌‌all‌‌these‌‌are‌‌optional.‌‌   ‌
 ‌
Do‌‌write‌‌your‌‌roll‌‌no‌‌and‌‌name‌‌at‌‌the‌‌beginning‌‌and‌‌at‌‌the‌‌end‌‌of‌‌the‌‌program‌‌as‌‌a‌‌comment.‌  ‌
 ‌
 ‌
 ‌
 ‌
 ‌
/*‌  ‌
‌*‌‌NAME‌‌:-‌‌AYUSH‌‌ARVINDKUMAR‌‌RANA‌  ‌
‌*‌‌ROLL‌‌NO.‌‌:-‌‌122‌  ‌
‌*/‌  ‌
#include‌‌<iostream>‌  ‌
using‌‌namespace‌‌std;‌  ‌
class‌‌student‌  ‌
{‌  ‌
‌public:‌  ‌
‌char‌ ‌name[30];‌  ‌
‌int‌ ‌rollNo;‌  ‌
‌void‌‌input()‌  ‌
‌{ ‌ ‌
  ‌ cout‌‌<<‌‌"Enter‌‌name:‌‌"‌‌<<‌‌"\n";‌  ‌
  ‌ cin‌‌>>‌‌name;‌  ‌
‌cout‌‌<<‌‌"Enter‌‌roll‌‌number:‌‌"<<‌‌"\n";‌  ‌
‌cin‌‌>>‌‌rollNo;‌  ‌
‌marksinput();‌  ‌
‌} ‌ ‌
‌private:‌  ‌
‌int‌‌sub_mark[3];‌  ‌
‌void‌‌marksinput()‌  ‌
‌{ ‌ ‌
  ‌ ‌cout‌‌<<‌‌"Enter‌‌marks‌‌of‌‌soft‌‌skill‌‌(301):‌‌"<<‌‌"\n"‌‌; ‌ ‌
  ‌ ‌cin‌‌>>‌‌sub_mark[0];‌  ‌
  ‌ ‌cout‌‌<<‌‌"Enter‌‌marks‌‌of‌‌Microprocessor‌‌and‌‌Assembly‌‌Language‌‌(302):‌‌"<<‌‌"\n"‌‌;‌  ‌
  ‌ ‌cin‌‌>>‌‌sub_mark[1];‌  ‌
  ‌ ‌cout‌‌<<‌‌"Enter‌‌marks‌‌of‌‌Data‌‌structure‌‌(303):‌‌"<<‌‌"\n"‌‌; ‌ ‌
  ‌ ‌cin‌‌>>‌‌sub_mark[2];‌  ‌
‌} ‌ ‌
‌void‌‌calgrade()‌  ‌
‌{ ‌ ‌
‌string‌‌grade[3];‌  ‌
‌int‌‌i;‌  ‌
‌for(i=0;i<3;i++)‌  ‌
‌{ ‌ ‌
‌if(sub_mark[i]>=91‌‌&&‌‌sub_mark[i]<=100)‌  ‌
‌{ ‌ ‌
‌grade[i]="A1"‌‌; ‌ ‌
‌} ‌ ‌
‌else‌‌if(sub_mark[i]>=81‌‌&&‌‌sub_mark[i]<91)‌  ‌
‌{ ‌ ‌
‌grade[i]="A";‌  ‌
‌} ‌ ‌
‌else‌‌if(sub_mark[i]>=71‌‌&&‌‌sub_mark[i]<81)‌  ‌
‌{ ‌ ‌
‌grade[i]="B1";‌  ‌
‌} ‌ ‌
‌else‌‌if(sub_mark[i]>=61‌‌&&‌‌sub_mark[i]<71)‌  ‌
‌{ ‌ ‌
  ‌ grade[i]="B";‌  ‌
‌} ‌ ‌
‌else‌‌if(sub_mark[i]>=51‌‌&&‌‌sub_mark[i]<61)‌  ‌
‌{ ‌ ‌
  ‌ grade[i]="C1";‌  ‌
‌} ‌ ‌
‌else‌‌if(sub_mark[i]>=41‌‌&&‌‌sub_mark[i]<51)‌  ‌
‌{ ‌ ‌
  ‌ grade[i]="C";‌  ‌
‌} ‌ ‌
‌else‌‌if(sub_mark[i]>=33‌‌&&‌‌sub_mark[i]<41)‌  ‌
‌{ ‌ ‌
  ‌ grade[i]="D(FAIL)";‌  ‌
‌} ‌ ‌
‌} ‌ ‌
‌cout‌‌<<"grade‌‌of‌‌soft‌‌skill‌‌(301):‌‌"‌‌<<‌‌grade[0]‌‌<<‌‌"\n";‌ 
‌cout‌‌<<"grade‌‌of‌‌Microprocessor‌‌and‌‌Assembly‌‌Language‌‌(302):‌‌"‌‌<<‌‌grade[1]‌‌<<‌‌"\n";‌  ‌
‌cout‌‌<<"grade‌‌of‌‌Data‌‌structure‌‌(303):‌‌"‌‌<<‌‌grade[2]‌‌<<‌‌"\n";‌  ‌
‌} ‌ ‌
‌public:‌  ‌
‌void‌‌display()‌  ‌
‌{ ‌ ‌
  ‌ ‌cout‌‌<<‌‌"Student‌‌details:\n";‌  ‌
  ‌ ‌cout‌‌<<‌‌"Name:"<<‌‌name‌‌<<‌‌"\n"<<‌‌"Roll‌‌Number:"‌‌<<‌‌rollNo‌‌<<‌‌"\n";‌  ‌
  ‌ ‌calgrade();‌  ‌
‌} ‌ ‌
};‌  ‌
 ‌
int‌‌main()‌  ‌
{‌  ‌
‌student‌‌std;‌  ‌
‌cout‌‌<<‌‌"Enter‌‌details‌‌of‌‌student‌‌"<<‌‌"\n";‌  ‌
‌std.input();‌  ‌
‌std.display();‌  ‌
‌return‌‌0;‌  ‌
}‌  ‌
/*‌  ‌
‌*‌‌NAME‌‌:-‌‌AYUSH‌‌ARVINDKUMAR‌‌RANA‌  ‌
‌*‌‌ROLL‌‌NO.‌‌:-‌‌122‌  ‌
‌*/‌  ‌
 ‌

You might also like