A.

#include<iostream.h>
#include<conio.h>
class student
{
private:
                int rn,s1,s2,s3,tm,n,x;
public:
                void input();
                void calculate();
};
void student::input()
{
                n=0;
                for(int i=0;i<10;i++)
                                {
                                cout<<"Enter Roll No:- ";
                                cin>>rn;
                                cout<<"Enter Marks of Three Subject:- ";
                                cin>>s1>>s2>>s3;
                                if(s1>=35 && s2>=35 && s3>=35)
                                                {
                                                tm=s1+s2+s3;
                                                cout<<"Roll Number:- "<<rn<<endl;
                                                cout<<"Total Marks:- "<<tm<<endl;
                                                }
                                else
                                                n++;
                                }
}
void student::calculate()
{
                cout<<endl<<"No of Student who secured less than 35 marks in any one or more than one subjects:- "<<n<<endl;
}
void main()
{
                student s;
                clrscr();
                s.input();
                s.calculate();
                getch();
}

B.

#include<iostream.h>
#include<conio.h>
class student
{
private:
                int rn,s1,s2,s3,tm;
public:
                void input();
                void output();
};
int n;
void student::input()
{
                cout<<"Enter Roll No:- ";
                cin>>rn;
                cout<<"Enter Marks of Three Subject:- ";
                cin>>s1>>s2>>s3;
}
void student::output()
{
                if(s1>=35 && s2>=35 && s3>=35)
                                {
                                tm=s1+s2+s3;
                                cout<<"Roll No:- "<<rn<<endl;
                                cout<<"Total Marks:- "<<tm<<endl;
                                }
                else
                                n++;
}
void main()
{
                student s;
                clrscr();
                for(int i=0;i<10;i++)
                                {
                                s.input();
                                s.output();
                                }
                cout<<endl<<"Number of Student less than 35 any Subject:- "<<n<<endl;
                getch();
}

 

Advertisements