Files
ooplab/lab6/18.cpp
Amneesh Singh ad185c994e labs 1-6: init
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-12-24 14:03:08 +05:30

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;
}