User Profile

Collapse

Profile Sidebar

Collapse
Alicia89
Alicia89
Last Activity: Apr 26 '12, 09:53 PM
Joined: Apr 19 '12
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Alicia89
    replied to Adding strings to vectors
    in C
    Yes I know that, how do you get a user to enter a new book? Here is my latest code:
    cout << "Enter book to add: "<< endl;
    getline(cin, book);
    books.push_back (book);

    the error says that there is no function call to getline. ??? I have all the appropriate header files.
    See more | Go to post

    Leave a comment:


  • Alicia89
    started a topic How to add strings to vectors?
    in C

    How to add strings to vectors?

    Hi,
    I have a vector I want to add book titles to, then i want to print my updated vector. This is best I have come up with but the program fails at the getline line. why? and how can I fix this?

    string book;
    cout << "Enter book to add: "<< endl;
    getline(cin, book);
    books.push_back (book);

    for(int i = 0; i < books.size(); ++i)...
    See more | Go to post

  • Alicia89
    replied to Adding strings to vectors
    in C
    Yes that would print the book name, but it wouldn't add it to the vector. I want to add the book to my vector.
    See more | Go to post

    Leave a comment:


  • Alicia89
    replied to Adding strings to vectors
    in C
    Sorry, I copied my code wrong. Suppose I have (yesorno == 'y').
    How do I get it to run? When I debug, I get the same response as when I run the program.
    I get alot of this message:/usr/include/c++/4.2.1/ostream:225: note: std::basic_ostr eam<_CharT, _Traits>& std::basic_ostr eam<_CharT, _Traits>::opera tor<<(long double) [with _CharT = char, _Traits = std::char_trait s<char>]
    /usr/include/c++/4.2.1/ostream:229:...
    See more | Go to post

    Leave a comment:


  • Alicia89
    started a topic Adding strings to vectors
    in C

    Adding strings to vectors

    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...
    See more | Go to post
No activity results to display
Show More
Working...