Hi,
I am a newbie at programming. I was given a project to program a library catalog. One of the aspects is that we have to allow an administrator to add, modify, and delete books from the catalog. It was recommended to me to use vectors. So I initialized by hand a default book list, and now I want to be able to have an adminisistrator add books and then print the modified book list. Here is what I have got:
main () {
char yesorno;
string bookname;
vector<string> books;
books.push_back ("The Jungle, Upton Sinclair");
....
books.push_back ("A Wrinkle in Time, Madaline L'Engle");
while (yesorno = 'y'){
cout << "Enter another book? (y/n)" << endl;
cin >> yesorno;
{
cout << "Enter the title, author."<< endl;
getline(cin, bookname);
cout << "You have just entered " << books.push_back (bookname) << endl;
I keep getting error messages. I am unsure what to do to fix this.
Any help would be greatly appreciated.
Sincerely,
Alicia
I am a newbie at programming. I was given a project to program a library catalog. One of the aspects is that we have to allow an administrator to add, modify, and delete books from the catalog. It was recommended to me to use vectors. So I initialized by hand a default book list, and now I want to be able to have an adminisistrator add books and then print the modified book list. Here is what I have got:
main () {
char yesorno;
string bookname;
vector<string> books;
books.push_back ("The Jungle, Upton Sinclair");
....
books.push_back ("A Wrinkle in Time, Madaline L'Engle");
while (yesorno = 'y'){
cout << "Enter another book? (y/n)" << endl;
cin >> yesorno;
{
cout << "Enter the title, author."<< endl;
getline(cin, bookname);
cout << "You have just entered " << books.push_back (bookname) << endl;
I keep getting error messages. I am unsure what to do to fix this.
Any help would be greatly appreciated.
Sincerely,
Alicia
Comment