expression must have class type error... at targetIsbn.compare

#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
#include "bookType.h"

using namespace std;



int main()
{
bookType b1 = bookType("Data structures");

vector<string> authorsName;
authorsName = { "ABC","DEF" };

b1.set_Book("Data Structrues", "XYZ", 5, 67837216, 1995,
90.50, authorsName);

if (!b1.check_Title())
cout << "The title of the book is same." << endl;
else
cout << "The title of the book is not same." << endl;
b1.display();


bookType b2 = bookType("Programming with C");

vector<string> authorsName1;
authorsName1 = { "GHI","JKL" };

b2.set_Book("Programming with C", "WXY", 5, 76873216, 1997,
200.50, authorsName1);

if (!b2.check_Title())
cout << "The title of the book is same." << endl;
else
cout << "The title of the book is not same." << endl;
b2.display();


b2.update_Book("Programming with C","WXY", 8, 76873216, 1998,
200.50, authorsName1);
cout << "The updates have been made." << endl;
b2.display();


vector<bookType> booklist;
booklist = { b1, b2 };
string targetTitle;

cout << "Enter the book title whcih is to be found: ";
cin >> targetTitle;
for (int i = 0; i < booklist.size(); i++)
{
if (targetTitle.compare(booklist[i].setTitle))
break;

if (i == booklist.size())
cout << "book with the title " << targetTitle << "is not found" << endl;
else
cout << "Book with the title " << targetTitle << "is found" << endl;
cout << endl;
}
int targetIsbn;

cout << "Enter the book isbn number which is to be found: ";
cin >> targetIsbn;
for (int i = 0; i < booklist.size(); i++)
{
if (targetIsbn.compare(booklist[i].isbn))
break;

if (i == booklist.size())
cout << "Book with the isbn number" << targetIsbn << "is not found" << endl;
else
cout << "Book with the isbn number" << targetIsbn << "is found" << endl;
cout << endl;
}
int copiesInStock = 10;

b1.update_numberOfCopies(copiesInStock);
cout << endl;
cout << "the number of copies for the book " << b1.setTitle << " has ben updated: ";

cout << b1.return_numberOfCopies();

b1.update_publisher("PQR");
cout << endl;
cout << "The publisher of the book" << b1.setTitle << "has been updated: ";
cout << b1.return_isbn();
b1.update_price(150.75);
cout << endl;
cout << "The price of the book" << b1.setTitle << "has been updated: ";
cout << b1.return_price();
vector<string> authorsName2;
authorsName2 = { "MNO","STU" };
b1.update_authors(authorsName2);
cout << endl;
cout << "The authors of the book" << b1.setTitle << "have been updated: " << endl;

authorsName2 = b1.return_authors();
for (int i = 0; i < booklist.size(); i++)
{
cout << authorsName2[i] << endl;
}
system("pause");
return 0;

}
targetTitle is a string therefore you can use its member function compare().

targetIsbn is an int, it does not have any member functions. Use == instead. Which you probably should use for targetTitle as well.
Topic archived. No new replies allowed.