I have wirtten the program , it executes but the only error it has is that when I run this program it is not proceeding further after entering a required data (some type of logical error :'( )
[
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
class publication
{
private:
string title;
float price;
public:
void getdata()
{
cout<<"Title:";getline(cin,title,' ');
cout<<"Price:";cin>>price;
}
void putdata()
{
cout<<"Title is=" <<title<<endl;
cout<<"Price is=" <<price<<endl;
}
};
class book:public publication
{
private:
int count;
public:
void getdata()
{
publication::getdata();
cout<<"Count:";cin>>count;
}
void putdata()
{
publication::putdata();
cout<<"Count is=" <<count<<endl;
}
};
class tape:public publication
{
private:
float playingtime;
public:
void getdata()
{
publication::getdata();
cout<<"Playing time:";cin>>playingtime;
}
void putdata()
{
publication::putdata();
cout<<"Playing time=" <<playingtime<<endl;
}
};
void main()
{
book b1;
tape t1;
b1.getdata();
b1.putdata();
t1.getdata();
t1.putdata();
}
]