#include <iostream.h>
#include <conio.h>
const int size=10;
#include <string.h>
class country
{
protected:
char cname[size];
float pprc;
float Iprc;
float ratio;
public:
country(){ }
virtual void getdata()
{
cout<<"Enter Country Name ";
cin>>cname;
cout<<"Enter the % of Polio ";
cin>>pprc;
cout<<"Enter the % of Literacy ";
cin>>Iprc;
}
virtual void display()
{
cout<<"\n";
cout<<"Country Name "<<cname<<endl;
cout<<"Country Polio% "<<pprc<<endl;
cout<<"Country Lit. % "<<Iprc<<endl;
cout<<"The Measure of Interdependency "<<float (pprc/Iprc)<<endl;
}
};
class state: public country
{
protected :
char sname[size];
float spprc;
float slprc;
float ratio;
public:
state() {}
void getdata()
{
country::getdata();
cout<<" \n";
cout<<"Enter State Name ";
cin>>sname;
cout<<"Enter %Age of Polio of State ";
cin>>spprc;
cout<<"Enter %Age of Lite. of State ";
cin>>slprc;
}
void display()
{
country::display();
cout<<"State Name "<<sname<<endl;
cout<<"%Age of Polio of State "<<spprc<<endl;
cout<<"%Age of Lite. of State "<<slprc<<endl;
cout<<"The Measure of Interdependency "<<float (spprc/slprc)<<endl;
}
};
void main( )
{
clrscr();
country *o1;
state o2;
cout<<"\n";
o1= &o2;
o1->getdata();
o2.display();
getch();
}