rendered paste body#include <iostream.h>
#include <string.h>
#define LENGTH 30
class Human{
private:
int ID;
char Name[LENGTH];
int Age;
public:
void SetHuman();
void SetHuman(int,char*,int);
int GetID();
char* GetName();
int GetAge();
void Print();
Human();
Human(int,char*,int);
};
void main(){
Human h1,h2(32,"xrhstos",4);
h1.SetHuman(40,"kwstas",10);
h1.Print();
h2.Print();
}
Human::Human(){
ID=0;
strcpy(Name,"");
Age=0;
}
Human::Human(int a,char* b,int c){
ID=a;
strcpy(Name,b);
Age=c;
}
void Human::SetHuman(){
cout<<"dwse times\n";
cin>>ID>>Name>>Age;
}
void Human::SetHuman(int a,char*b,int c){
ID=a;
strcpy(Name,b);
Age=c;
}
int Human::GetID(){
return ID;
}
char*Human::GetName(){
return Name;
}
int Human::GetAge(){
return Age;
}
void Human::Print(){
cout<<"o kwdikos einai:"<<ID<<endl;
cout<<"to onoma einai:"<<Name<<endl;
cout<<"h hlikia einai:"<<Age<<endl;
cout<<endl;
}