Hello everyone I have made this simple program but there is some problem in taking input book name the program just skip the cin.get() function and then return 0, and I dont know why it's not working although there are no errors. any help would be appreciated. thank you
#include<iostream>
using namespace std;
struct book
{
private:
int bookid;
char name[30];
float price;
public:
input()
{
cout<<"\n Enter book ID: ";
cin>>bookid;
if(bookid<0)
{
bookid = -bookid;
}
cout<<"\nEnter book title: ";
cin.get(name,30); // here is the problem
cout<<"\nEnter book price: ";
cin>>price;
}
display()
{
cout<<"\nBook ID: "<<bookid<<"\nbook title: "<<name<<"\nprice: "<<price;
}
};
int main()
{
book b1;
b1.input();
b1.display();
return 0;
}