How do I declare this?
Dec 4, 2015 at 5:25am UTC
I need to delcare patronIDMatch and bookIDMatch as bools, but i dont know how to do it without editing the header (which i'm prohibited of touching)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*******************************************
** Description: checkOutBook function
********************************************/
std::string Library::checkOutBook(std::string pID, std::string bID) {
bool patronIDMatch = false , bookIDMatch = false ;
int bookOnFile = -1, patronOnFile = -1;
for (int i = 0; i<members.size(); i++) {
if (pID == members[i]->getIdNum()) {
patronIDMatch = true ;
patronOnFile = i;
break ;
}
else continue ;
}
for (int i = 0; i<holdings.size(); i++) {
if (bID == holdings[i]->getIdCode()) {
bookIDMatch = true ;
bookOnFile = i;
break ;
}
else continue ;
i tried to declare it here but for some reason it's not working. any idea why? I get the error
Library.cpp:88: error: ‘PatronIDMatch’ was not declared in this scope
Dec 4, 2015 at 6:09am UTC
Library.cpp:88: error: ‘PatronIDMatch’ was not declared in this scope
The variable in the error has a capital 'P', apart from that there doesn't seem to be enough information. Which is line 88? You can put a firstline number in your code tag [code firstline=80]
http://www.cplusplus.com/articles/z13hAqkS/
It's usually a good idea to copy / paste errors verbatim.
Topic archived. No new replies allowed.