#include <iostream>
using namespace std;
class Student
{
protected:
float avg;
public:
void Show();
};
class ComputerScience:public Student
{
float OOPL, OS, NM ;
public:
void GetMarks1();
void ShowMarks1();
void CalAvg1();
};
class Mathematics:public Student
{
float Calculus, LA, Geometry ;
public:
void GetMarks2();
void ShowMarks2();
void CalAvg2();
};
void Student::Show()
{
cout << endl << "Average=" << avg << endl ;
}
void ComputerScience::GetMarks1()
{
cout << endl << "Enter marks of:" << endl ;
cout << endl << "OOPL:" ;
cin >> OOPL ;
cout << endl << "NM:" ;
cin >> NM ;
cout << endl << "OS:" ;
cin >> OS ;
}
void ComputerScience::ShowMarks1()
{
cout << endl << "Computer Science:" << endl ;
cout << endl << "OOPL=" << OOPL << endl << "NM=" << NM << endl << "OS=" << OS << endl ;
}
void ComputerScience::CalAvg1()
{
avg = (OOPL + NM + OS)/3 ;
}
void Mathematics::GetMarks2()
{
cout << endl << "Enter Marks of:" << endl ;
cout << endl << "Calculus:" ;
cin >> Calculus ;
cout << endl << "LA:" ;
cin >> LA ;
cout << endl << "Geometry:" ;
cin >> Geometry ;
}
void Mathematics::ShowMarks2()
{
cout << endl << "Mathematics:" << endl ;
cout << endl << "Calculus=" << Calculus << endl << "LA=" << LA << endl << "Geometry=" <<
Geometry << endl ;
}
void Mathematics::CalAvg2()
{
avg = (Calculus + LA + Geometry)/3 ;
}
int main()
{
ComputerScience CS;
CS.GetMarks1();
CS.CalAvg1();
Mathematics M;
M.GetMarks2();
M.CalAvg2();
CS.ShowMarks1();
CS.Show();
M.ShowMarks2();
M.Show();
return 0;
}
C and C++ programs, games, softwares. Easy programming guide. Learn to code and enjoy coding in CoderNepal
Home » OOPL TU 2066 Q.N.3
OOPL TU 2066 Q.N.3
This is the solution for T.U. 2066 Q.N. 3
Subscribe to:
Comments (Atom)
No comments:
Post a Comment