#include<iostream> #include<vector> #include<fstream> #include "Library.h" #include "sqlite3.h" void Library::ManageCheckout() { control = 1; while(control != 4) { cout << endl << "What would you like to do?" << endl; cout << "1 - Show checkouts" << endl; cout << "2 - Check-out material" << endl; cout << "3 - Check-in material" << endl; cout << "4 - Return to main menu" << endl; cout << "-->"; cin >> control; while(control < 1 || control > 4) { cout << "Incorrect input, try again" << endl << "-->"; cin >> control; } switch(control) { case 1: PrintCheckouts(); break; case 2: checkOut(); break; case 3: checkIn(); break; case 4: break; } } } void Library::PrintCheckouts() { //Typical select statement layout, it can all go in one line if you want cout << sqlite3_exec(db, //<-- created in Library.cpp after libraries are included, links the program to the database "select * from Checkout;", //<-- Select statement goes here NULL, //Always put these next three arguments in when issuing an SQL command 0, NULL); } /*void Library::BookCheckout() {*/ //Prompt user for data bool checkOut( const std::vector<ManagePatrons>& vecPatrons, const std::vector<ManageMaterials>& vecMaterials, std::vector<checkOut>& vecChecked ){ Patron patronOut; Material materialOut; bool success = false; std::string strDate = ""; // Get the patron. patronOut = selectPatron( vecPatrons ); // Get the material. materialOut = selectMaterial( vecMaterials ); // Get the due date. do{const std::vector<Patron>& vecPatrons, const std::vector<Material>& vecMaterials, std::vector<CheckedOut>& vecChecked std::cout << "Enter the due date (mm/dd/yyyy): "; cin >> strDate; if( strDate.length() < 10 ){ // Alert user. std::cout << "Error! Invalid date format." << endl; } else { success = true; } } while( !success ); // Add this item to the list of checked out items. vecChecked.push_back( CheckedOut( patronOut.getID(), materialOut.getTitle(), strDate ) ); return success; //Enter data into Header file //Insert data into database } /*void Library::BookCheckin() {*/ //Ask what book was checked out bool checkIn( const std::vector<Patron>& vecPatrons, std::vector<CheckedOut>& vecChecked ){ bool success = false; // Function variables... static const int LIST_SIZE = 10; int offset = 0; int selection = -1; char cSelect = ' '; bool valid = false; bool found = false; do{ std::cout << "Make a selection from the menu below: " << endl << endl; // Print the specified number of entries. for( int menuCnt = 0; menuCnt < LIST_SIZE && menuCnt+offset < vecChecked.size(); ++menuCnt ){ // Print out each line selection option. cout << menuCnt+1 << ".\t"; // Find and print the patron's name. for(std::vector<Patron>::const_iterator iter_patron = vecPatrons.begin(); iter_patron < vecPatrons.end() && !found ; ++iter_patron ){ found = (iter_patron->getID() == vecChecked[offset+menuCnt].getPatronID() ); if( found ){ cout << iter_patron->getName().toStr(); } } std::cout << "\t" << vecChecked[offset+menuCnt].getMaterial() << "\t" << vecChecked[offset+menuCnt].getDueDate() << endl; } if( offset > 0 ){ std::cout << "\t\t p for previous page"; } if( offset < (int) vecChecked.size() - LIST_SIZE ){ std::cout << "\t\t n for next page"; } std::cout << endl << endl << "Enter selection: "; cin.ignore(1); // Ignore previous return stroke. cin >> cSelect; switch( cSelect ){ case 'p': case 'P': if( offset > 0 ){ offset -= LIST_SIZE; } break; case 'n': case 'N': if( offset < (int) vecPatrons.size() - LIST_SIZE ){ offset += LIST_SIZE; } break; default: selection = (int) cSelect - 49; if( selection < 0 || selection > 9 ){ // Alert user. std::cout << "Error! Invalid selection attempted." << endl << endl; } else { // Set flag for a valid entry. selection += offset; valid = true; } } }while( !valid ); // Remove the selected checked material from the vector. vecChecked.erase( vecChecked.begin() + selection ); return success; }
Codeblocks tells me that line 70 has impromper declarations and incompatible types. then it also says my atoi function is not properly declared. I have tried getting assistance from my instructor however she says she is lost by my code and doesn't know how to help me. I have also tried googling to look for references and help but haven't had any luck thus far.