problem !i

the code isn't running on the codeblock
#include<iostream>
#include<string.h>
using namespace std;
class person
{
char name[20];
float age;
public:
person(char *s,float a)
{
strcpy(name,s);
age=a;
}
person & person :: greater( person &x)
{
if(x.age>=age)
return x;
else
return *this;
}
void display(void)
{
cout<<"Name:"<<name<<"\n"<<"Age:"<<age<<"\n";
}
main()
{
person P1("John",37.50),P2("Ahmed",29.0),P3("Hebber",40.25);
person P('\o',o);
P=P1.greater(P3);
cout<<"Elder person is: \n";
P=P1.greater(P2);
cout<<"Elder person is: \n";
P.display();
}
}
main() is missing its identifier
==> int main

there is no \o command for the output

you have some problems with brackets
is there any problem in this line
person & person :: greater( person &x)
Topic archived. No new replies allowed.