+ 1
Plz tell output along with functioning and reasons!!!
#include <iostream> #include <string> using namespace std; class per{ char name[20] ; float age; public: per(char *s,float a) { strcpy(name,s);age=a; } per & GR(per&x) {if(x.age>=age) return x; else return *this;} void display() {cout<<"Name:"<<name<<"\n"; cout<<"Age :"<<age<<"\n";}}; int main() { per P1("Ramu",27.5),P2("Raju",53),P3("Kalu",40); per P('\0',0); P=P1.GR(P3);P.display (); P=P2.GR(P3);P.display ();}
1 ответ
+ 24
first add string.h header file
it probably can give error in strcpy function