#include<iostream>
#include<iomanip>
using namespace std;
class Person{
private:
string name;
float age, height;
public: Person(){ }
Person(string na, float ag, float hi){
name = na;
age =ag;
height = hi;
}
const void getInput(){
cout<<"person name\t"<<endl;
cin>>name;
cout<<"person age\t"<<endl;
cin>>age;
cout<<" person height\t"<<endl;
cin>>height;
}
const void showOutput(){
cout<<"Name: \t"<<name;
cout<<setw(60)<<"\tAge is\t"<<age<<"\tHeight\t"<<height<<endl;
}
const bool isTaller(Person p){
if(p.height < this->height){
return true;
}
else{
return false;
}
}
};
int main()
{
Person t1("Don",17,4);
Person t2("Saul",20,10);
Person t3("David",7,7);
Person o[3] ={t1,t2,t3};
Person t4 = t1;
if(t2.isTaller(t1) == true && t2.isTaller(t3) == true){
t4 = t2;
}
else if(t3.isTaller(t1) == true && t3.isTaller(t2)){
t4 = t3;
}
cout<<"Tallest person: \n";
t4.showOutput();
}
Comments
Leave a comment