c++ - class member function won't return -
i have following code:
void module_books::show_item(int n, table<book> b) { cout<<"title: "<<b[n]->title<<"\n"; cout<<"author: "<<b[n]->author<<"\n"; cout<<"issue: "<<"no. "<<b[n]->issueno<<". "<<b[n]->city<<", "<<b[n]->publisher<<", "<<b[n]->year<<"\n"; cout<<"isbn: "<<b[n]->isbn<<"\n"; cout<<"pages count: "<<b[n]->pages<<"\n"; cout<<"information: loan count: "<<b[n]->outcount<<". "; if(b[n]->damaged) cout<<"damaged "; if(b[n]->out) cout<<"loaned"; cout<<"\n\n"; } int module_books::add_item(table<book> &b) { int _year, _issueno, _pages; bool _damaged=false; string _title, _author, _isbn, _publisher, _city, stmp; cout<<"you're adding new book list.\nfill in following fields:\n\n"; cout<<"title: "; getline(cin,_title); cout<<"author: "; getline(cin,_author); cout<<"issue no: "; cin>>_issueno; cin.ignore(std::numeric_limits<std::streamsize>::max(), l'\n'); cout<<"issued in (city): "; getline(cin,_city); cout<<"issuer: "; getline(cin,_publisher); cout<<"issued in (year): "; cin>>_year; cin.ignore(std::numeric_limits<std::streamsize>::max(), l'\n'); cout<<"isbn: "; getline(cin,_isbn); cout<<"pages count: "; cin>>_pages; cout<<"is damaged? (y/n): "; cin>>stmp; cin.ignore(std::numeric_limits<std::streamsize>::max(), l'\n'); if(stmp=="y" || stmp=="yes" || stmp=="y" || stmp=="yes" || stmp=="yes") _damaged=true; int n=b.size(); b.push_back(book(_title,_author,_publisher,_city,_isbn,_year,_issueno,_pages,_damaged)); cout<<"\nthe book has been added:\n\n"; show_item(n,b); cout<<"\nreturning\n"; return n; }
book struct member variables. table struct template, works stl vector (i'm not allowed use vector, had write own template, @ moment it's using static array t ar[100]
).
the problem message book has been added , show_item function prints data, no "returning" message.
i tried setting breakpoints show_table
function reaches ending }
, program never gets "returning" message.
what might wrong code? i'm using 32-bit qtcreator mingw. os 64-bit win8.1 if help...
Comments
Post a Comment