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 6736245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:06:26+00:00 2026-05-26T11:06:26+00:00

so i got that first problem working. i run the code and i am

  • 0

so i got that first problem working. i run the code and i am prompt to enter some list into the array. after entering the list i run this function as a search_func. but it keeps return no record found. is it because of [0], odd because i have it within a for loop.

Please help. book books[] is a class object..

int search(book books[], char search) {
    const char* boook =books[0].gettitle();
  //......try this but it failed please help
  cout << "Search books by title:____  ";

  cin >> search;

  bool yes = false;
  int size=2;

  for(int index=0; index<size; index++) {
    if(strcmp(boook,search) == 0 )//....error at this line
         { 
        found = true;
        cout<<"book found "<<endl;
        //cout<<"Author Name: "<<fn<<" "<<ln<<endl;
        break;
      }
  }

  if(!yes)
    cout<<"no book found"<<endl;
}
  • 1 1 Answer
  • 0 Views
  • 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-26T11:06:26+00:00Added an answer on May 26, 2026 at 11:06 am

    Try this:

    const char* c_str = books[0].gettitle().c_str();
    

    http://www.cplusplus.com/reference/string/string/c_str/

    EDIT:

    If gettitle() returns a temporary, then the above method won’t work. You will need to do this instead:

    string title = books[0].gettitle();
    const char* c_str = title.c_str();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got the problem that the if-statement doesn't work. After the first code line
After I solved my first problem I got into another one. Looks like I'm
I first got an error usign the code below, explaining that DataGridLinkButton' must be
I am working on some code that has to manipulate unicode strings. I am
In trying to implement the repository pattern I've run into a minor problem that
I'm Trying to optimize my code, and I got into a problem I don't
I've got a bunch of first names in a field that carry a middle
I am trying to put 2 columns into a website, I've got that to
I've got listbox that employs an item template. Within each item in the list,
I've got model that use ExtendAssociations , but for some reason deleteHABTM doesn't seem

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.