Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3396630
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:25:51+00:00 2026-05-18T04:25:51+00:00

i need to write a program in which main() would read a file(containing some

  • 0

i need to write a program in which main() would read a file(containing some predefined instructions) and create classes for each line and if a class object was already created, create a new class object.. something like

main()
{
     read file;
     save to a vector;

     for(i < vectorsize; i++)
          if(vector[i]== "book")
                 if(book b was already created) 
                       book c; 
                 else book b;
}
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:25:51+00:00Added an answer on May 18, 2026 at 4:25 am

    You might use a std::map to store the created books. A map is a key->value store where you can adress the content by a own defined key.

    typedef std::map<std::string, Book> BookMap;
    int main()
    {
         read file;
         save to a vector;
         BookMap books;
    
         for(i < vectorsize; i++)
              if(vector[i]== "book")
                     BookMap::const_iterator alreadyCreatedBook(books.find(b.name));
                      // When there is no book in the map, the map returns it's end() element
                     if(books.end() != createdBook)
                           alreadyCreatedBook->second; 
                     else
                         books[b.name] = b;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write one java program which monitors a folder containing excel sheets
I need to write an I2C program which can write data to 32 bit
I need to write a program which gets 4 arguments, the first one a
I need to write a program which reverses the order of the bytes in
I have to write a program in which main calls other functions that test
Ok, I need some help here. I'm attempting to write a program that rolls
I need to write a programm which uses threads and sockets. What is the
I need to write a program that prints 0.(03) for input 1 and 33.
I need to write a program that takes input line at a time and
i need to write a program in c# to collect information about processes running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.