
please wait
#include <string> #include <iomanip> using namespace std; class BOOK { public: BOOK ( string ); void setbook ( string ); string getbooktype(); void welcomemessage(); void inputbook(); void checkout(); private: string book; int totalbook1; int totalbook2; int totalbook3; int totalbook4; int totalbook5; double pricebook1; double pricebook2; double pricebook3; double pricebook4; double pricebook5; }; |
// BOOKAZINE.cpp #include <iostream> #include <iomanip> #include "switch.h" using namespace std; BOOK::BOOK ( string name ) { setbook( name ); totalbook1 = 0; totalbook2 = 0; totalbook3 = 0; totalbook4 = 0; totalbook5 = 0; pricebook1 = 0; pricebook2 = 0; pricebook3 = 0; pricebook4 = 0; pricebook5 = 0; } void BOOK::welcomemessage() { cout << "Welcome to BOOKAZINE WEB"; cout << "Books Available in the BOOKAZINE WEB"; cout << setw(3) << "\n 1 (Ladybird - $15.98)"; cout << setw(3) << "\n 2 (Sidney Sheldon - $25.50)"; cout << setw(3) << "\n 3 (Nora Roberts - $28.45)"; cout << setw(3) << "\n 4 (Penguin Classics - $40.55)"; cout << setw(3) << "\n 5 (Virginia Andrews - $42.98)"; } void BOOK::inputbook() { int choice; double totalprice; totalprice = pricebook1 + pricebook2 + pricebook3 + pricebook4 + pricebook5; cout << "Input a value based on the book type (-1 to quit)"; cin >> choice; int counter; switch (choice) { case '1': ++counter; ++totalbook1; pricebook1 += 15.98; break; case '2': ++counter; ++totalbook2; pricebook2 += 25.50; break; case '3': ++counter; ++totalbook3; pricebook3 += 28.45; break; case '4' : ++counter; ++totalbook4; pricebook4 += 40.55; break; case '5' : ++counter; ++totalbook5; pricebook5 += 42.98; break; case '-1' : cout << "CHECKOUT"; cout << "Ladybird :" << setw(3) << "X" << totalbook1 << setw(3) << pricebook1; cout << "Sidney Sheldon :" << setw(3) << "X" << totalbook2 << setw(3) << pricebook2; cout << "Nora Roberts :" << setw(3) << "X" << totalbook3 << setw(3) << pricebook3; cout << "Penguin Classics :" << setw(3) << "X" << totalbook4 << setw(3) << pricebook4; cout << "Virginia Andrews :" << setw(3) << "X" << totalbook5 << setw(3) << pricebook5; cout << "\n______________________________________\n"; cout << "Total Book Purchased : " << setw(3) << counter; cout << "Total Book Cost : " << setw(3) << totalprice; default: cout << "You have inputted an invalid value!"; cout << "Please enter a valid value"; break; } } |
Anybod1>------ Build started: Project: BOOKAZINEWEB, Configuration: Debug Win32 ------ 1>BOOKAZINEWEB.obj : error LNK2019: unresolved external symbol "public: void __thiscall BOOK::setbook(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?setbook@BOOK@@QAEXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: __thiscall BOOK::BOOK(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0BOOK@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup 1>C:\Users\SONY\Documents\Visual Studio 2010\Projects\BOOKAZINEWEB\Debug\BOOKAZINEWEB.exe : fatal error LNK1120: 2 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
What is the problem? |
BOOK:setBook()
. I mean what the rules of the function are and how they are going to manipulate the string parameter passed to the function.