60 lines
974 B
C++
60 lines
974 B
C++
#include <iostream>
|
|
using namespace std;
|
|
|
|
class BasicInfo {
|
|
private:
|
|
char name[30];
|
|
uint enrollment;
|
|
char gender;
|
|
|
|
public:
|
|
void getData();
|
|
void putData();
|
|
};
|
|
|
|
void BasicInfo::getData() {
|
|
cout << "Name: ";
|
|
cin >> name;
|
|
cout << "Enrollment: ";
|
|
cin >> enrollment;
|
|
cout << "Gender: ";
|
|
cin >> gender;
|
|
}
|
|
void BasicInfo::putData() {
|
|
cout << "Name: " << name << endl
|
|
<< "Enrollment: " << enrollment << endl
|
|
<< "Gender: " << gender << endl;
|
|
}
|
|
|
|
class PhysicalFit : public BasicInfo {
|
|
uint height;
|
|
uint weight;
|
|
|
|
public:
|
|
void getData();
|
|
void putData();
|
|
};
|
|
|
|
void PhysicalFit::getData() {
|
|
cout << "Weight (in kg): ";
|
|
cin >> weight;
|
|
cout << "Height (in cm): ";
|
|
cin >> height;
|
|
}
|
|
|
|
void PhysicalFit::putData() {
|
|
cout << "Weight (in kg): " << weight << endl
|
|
<< "Height (in cm): " << height << endl;
|
|
}
|
|
|
|
int main() {
|
|
PhysicalFit x;
|
|
x.BasicInfo::getData();
|
|
x.getData();
|
|
|
|
x.BasicInfo::putData();
|
|
x.putData();
|
|
|
|
return 0;
|
|
}
|