0

This is my first post here, and I have to say that you've saved me a lot of times! But, in this moment I've got a problem.

In this code (this is the main of my project, and yes, I'm Italian and at my school if you write code in English you have to translate it in Italian, sorry for that...) that has object and classes with inheritance, the problem is that the first time you input the data of the book (yes, it's for a library) it write it correctly, the second time it jumps the first voice of input (Author generality) and goes straight to the name of the book. What can I do to avoid that the program does this?

Thanks in advance, and good coding to all of you!

system("CLS");
cout<<"\nInserisci le generalita' dell'autore: ";
cin.ignore(-1);
getline(cin,nome);
cout<<"nome "<<nome;

cout<<"\nInserisci il nome del libro: ";
cin.ignore(-1);
getline(cin,nomelibro);
cout<<"nome libro "<<nomelibro;

cout<<"\nInserisci il genere del libro: ";
cin.ignore(-1);
getline(cin,genere);
cout<<"genere "<<genere;

cout<<"\nInserisci il prezzo del libro: ";
cin>>prezzo;
cout<<"prezzo "<<prezzo;

cout<<"\nInserisci il codice a barre del prodotto: ";
cin>>codice;

disponibile = true;

Libro nuovolibro (nome,nomelibro,genere,prezzo,codice,disponibile);

vettore.push_back(nuovolibro);
  • It's hard to guess exactly where in this code the problem is (especially since I don't know Italian). You could help by posting a much smaller version with all the parts that aren't needed to reproduce the problem removed. (See: [mcve].) – aschepler Apr 18 '18 at 11:27
  • I'll edit it in a few seconds and then I'll read the question that's marked as duplicate to mine. – Giulio Bilato Apr 18 '18 at 11:28

0 Answers0