In my program, I used a vector to store the file. The file contains the data (see below).
Do I need to create two vectors to store the data below as integers and strings?
Or is there a shorter way to do this, and just allow the user to enter the ISBN number and returns the TITLE, AUTHOR, and AVAILABLE Status? Thanks for the help!

1397805387 Programming Logic & Design Farrell Y
1397814380 Understanding Operating Systems Flynn,Mchoes Y
1397801321 Problem SOlving in C++ Savitch Y
1397802575 Java How to Program Deitel Y
0201743876 Database Management Riccardi Y
0887307876 Dilbert Principle Adams N
0805375651 Unix Systems Sobell N
0201094381 COmputer Animation Weinstein Y
1397814239 C# Programming Doyle Y
0130351814 Core Perl Lerner N

Probably the easiest solution is to define a structure type (or a class, if you've gotten that far in your studies), and then declare a vector of that type. Something like the following should do:

struct Book
{
    long isbn;
    std::string title;
    std::string author;
    bool available;
};

std::vector<Book>;

yea we have not gone to objected oriented yet, but thanks for the reply though.


Probably the easiest solution is to define a structure type (or a class, if you've gotten that far in your studies), and then declare a vector of that type. Something like the following should do:

struct Book
{
    long isbn;
    std::string title;
    std::string author;
    bool available;
};

std::vector<Book>;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.