Question

my program wont run on my computer and im not understanding why. please help. #include<iostream> #include<iomanip>...

my program wont run on my computer and im not understanding why. please help.

#include<iostream>
#include<iomanip>
#include<string>
#include "bookdata.h"
#include "bookinfo.h"
#include "invmenu.h"
#include "reports.h"
#include "cashier.h"

using namespace std;

const int ARRAYNUM = 20;
BookData bookdata[ARRAYNUM];

int main ()
{
bool userChoice = false;
while(userChoice == false)
{
int userInput = 0;
bool trueFalse = false;

cout << "\n" << setw(45) << "Serendipity Booksellers\n"
<< setw(39) << "Main Menu\n\n"
<< "1.Cashier Module\n"
<< "2.Inventory Database Module\n"
<< "3.Report Module\n"
<< "4.Exit\n";

do{
cout << "\nEnter your choice: ";
cin >> userInput;

if(userInput >= 1 && userInput <= 4)
{ trueFalse = true; }
else
{ cout << "\nPlease enter a number in the range 1 - 4.\n"; }
}while(trueFalse != true);

switch(userInput)
{
case 1: cashier(); break;
case 2: invmenu(bookdata,ARRAYNUM); break;
case 3: reports(); break;
case 4:
cout << "\nExiting Program\n\n";
userChoice = true;
break;
}
}
return 0;
}


//bookdata.cpp

#include<iostream>
#include<iomanip>
#include<string>
#include "bookdata.h"
using namespace std;


BookData::BookData()
{
bookTitle = "";
isbn = "";
author = "";
publisher = "";
dateAdded = "";
qtyOnHand = 0;
wholesale = 0;
retail = 0;
Empty = true;
};

void BookData::setTitle(string t)
{ bookTitle = t; };
void BookData::setIsbn(string i)
{ isbn = i; };
void BookData::setAuthor(string a)
{ author = a; };
void BookData::setPub(string p)
{ publisher = p; };
void BookData::setDateAdded(string d)
{dateAdded = d; };
void BookData::setQty(int q)
{ qtyOnHand = q; };
void BookData::setWholesale(double w)
{ wholesale = w; };
void BookData::setRetail(double r)
{ retail = r; };

bool BookData::isEmpty()
{ return Empty; };
void BookData::insertBook()
{ Empty = false; };
void BookData::removeBook()
{ Empty = true; };

string BookData::getTitle()
{ return bookTitle; };
string BookData::getIsbn()
{ return isbn; };
string BookData::getAuthor()
{ return author; };
string BookData::getPub()
{ return publisher; };
string BookData::getDateAdded()
{ return dateAdded; };
int BookData::getQty()
{ return qtyOnHand; };
double BookData::getWholesale()
{ return wholesale; };
double BookData::getRetail()
{ return retail; };

//bookdata.h

#include<iostream>
#include<iomanip>
using namespace std;

class BookData
{
private:
string bookTitle;
string isbn;
string author;
string publisher;
string dateAdded;
int qtyOnHand;
double wholesale;
double retail;
bool Empty;

public:
BookData();
void setTitle(string);
void setIsbn(string);
void setAuthor(string);
void setPub(string);
void setDateAdded(string);
void setQty(int);
void setWholesale(double);
void setRetail(double);

bool isEmpty();
void insertBook();
void removeBook();

string getTitle();
string getIsbn();
string getAuthor();
string getPub();
string getDateAdded();
int getQty();
double getWholesale();
double getRetail();
};


//bookinfo.cpp


#include<iostream>
#include<iomanip>
#include<string>
#include "bookdata.h"
#include "bookinfo.h"
using namespace std;

void bookinfo (BookData d[], int i)
{
cout << setw(45) << "Serendipity Booksellers\n"
<< setw(42) << "Book Information\n\n";

cout << "\nISBN: " << d[i].getIsbn()
<< "\nTitle: " << d[i].getTitle()
<< "\nAuthor: " << d[i].getAuthor()
<< "\nPublisher: " << d[i].getPub()
<< "\nDate Added: " << d[i].getDateAdded()
<< "\nQuantity-On-Hand: " << d[i].getQty()
<< fixed << setprecision(2)
<< "\nWholesale Cost: $" << d[i].getWholesale()
<< "\nRetail Price: $" << d[i].getRetail() << "\n";

}

//bookinfo.h

#include<iostream>
#include<iomanip>
using namespace std;

void bookinfo(BookData[], int);


//cashier.cpp

#include<iostream>
#include<iomanip>
#include<string>
#include "cashier.h"
#include "bookdata.h"
using namespace std;

void cashier ()
{
bool userChoice = false;
while(userChoice == false)
{
string dateBook, codeBook, titleBook;
int numBook;
double priceBook;

cout << "\nSerendipity Booksellers"
<< "\nCashier Module\n\n";

cout << "Date: ";
cin >> dateBook;
cout << "Quantity of Book: ";
cin >> numBook;
cout << "ISBN: ";
cin >> codeBook;
cout << "Title: ";
cin >> titleBook;
cout << "Price: ";
cin >> priceBook;
cout << "\n\n";

cout << "Serendipity Booksellers\n\n"
<< "Date: " << dateBook << "\n\n";

cout << setw(5) << left << "Qty "
<< setw(8) << left << " ISBN "
<< setw(15) << left << " Title "
<< setw(6) << left << " Price "
<< setw(6) << left << " Total\n";

cout << "------------------------------------------\n";

cout << fixed << setprecision(2)
<< setw(5) << numBook
<< setw(8) << codeBook
<< setw(15) << titleBook
<< "$" << setw(6) << priceBook
<< "$" << setw(6) << (numBook * (priceBook * 1.06)) << "\n\n";

cout << "\n" << setw(15) << right << "Subtotal:" << setw(20) << "$" << priceBook
<< "\n" << setw(15) << right << "Tax:" << setw(20) << "$" << (numBook * (priceBook * .06))
<< "\n" << setw(15) << right << "Total:" << setw(20) << "$" << (numBook * (priceBook * 1.06))
<< "\n\nThank You For Shopping Serendipity!\n\n";

char choice = NULL;
cout << "\nIs there another transaction that is to be processed?(y/n): ";
cin >> choice;
if( choice == 'n' || choice == 'N' ){userChoice = true;}
}

}

//cashier.h

#include<iostream>
#include<iomanip>
using namespace std;

void cashier();

//invmenu.cpp

#include<iostream>
#include<iomanip>
#include<string>
#include"bookdata.h"
#include"bookinfo.h"
#include"invmenu.h"
using namespace std;

void invmenu(BookData bookdata[], const int NUM)
{

bool userChoice = false;
while(userChoice == false)
{
int userInput = 0;
bool trueFalse = false;

cout << "\n" << setw(45) << "Serendipity Booksellers\n"
<< setw(43) << "Inventory Database\n\n"
<< "1.Look-up a Book\n"
<< "2.Add a Book\n"
<< "3.Edit a Book's Record\n"
<< "4.Delete a Book\n"
<< "5.Return to the Main Menu\n";

do{
cout << "\nEnter your choice: ";
cin >> userInput;

if(userInput >= 1 && userInput <= 5)
{ trueFalse = true; }
else
{ cout << "\nPlease enter a number in the range 1 - 5.\n"; }

}while(trueFalse != true);

switch(userInput)
{
case 1: lookUpBook(bookdata); break;
case 2: addBook(bookdata); break;
case 3: editBook(bookdata); break;
case 4: deleteBook(bookdata); break;
case 5:
userChoice = true;
break;
}

}

}


void lookUpBook(BookData d[])
{
string u = "";
int b = 0;
cout << "\nEnter the Title or IBSN: ";
cin >> u;
b = findBook(d, u);

if( b == -1 )
{ cout << "\nBook not found."; }
else
{bookinfo(d, b); }
}

int findBook(BookData d[], string u)
{
int fb = 0;

for(int i = 0; i < 20; i++)
{
cout << "\nBonk " << i << "\n";

if(u == d[i].getTitle() || u == d[i].getIsbn())
{ fb = i; break; }
else
{fb = -1;}
}
return fb;
}

void addBook(BookData d[])
{
int space;
for(int i = 0; i <= 20; i++)
{
//cout << "\nBonk " << i << "\n";
if(d[i].isEmpty() != false)
{ space = i; break; }
}

if(space != -1)
{
string temp = "";
int t = 0;
double td = 0;

d[space].insertBook();
cout << "Book Title: "; cin >> temp; d[space].setTitle(temp);
cout << "ISBN: "; cin >> temp; d[space].setIsbn(temp);
cout << "Author: "; cin >> temp; d[space].setAuthor(temp);
cout << "Publisher: "; cin >> temp; d[space].setPub(temp);
cout << "Date Added: "; cin >> temp; d[space].setDateAdded(temp);
cout << "Quantity to be Added: "; cin >> t; d[space].setQty(t);
cout << "Wholesale: $"; cin >> td; d[space].setWholesale(td);
cout << "Retail: $"; cin >> td; d[space].setRetail(td);
}
}

void editBook(BookData d[])
{
bool trueFalse = false;
string u = "";
int b = 0;
cout << "\nEnter the Title or IBSN: ";
cin >> u;
b = findBook(d, u);

if( b == -1 )
{ cout << "\nBook not found."; trueFalse = true;}

while(trueFalse != true)
{
bookinfo(d, b);
string temp = "";
int t = 0;
double td = 0;

cout << "\nEdit\n1.Title\n2.ISBN\n3.Author\n4.Publisher\n5.Date Added\n6.Quantity\n7.Wholesale\n"
<< "8.Retail\n9.Exit\n";

bool aaa = false;
do{
cout << "\nEnter your choice: ";
cin >> t;

if(t >= 1 && t <= 9)
{ aaa = true; }
else
{ cout << "\nPlease enter a number in the range 1 - 9.\n"; }

}while(aaa != true);

switch(t)
{
case 1: cout << "Book Title: "; cin >> temp; d[b].setTitle(temp); break;
case 2: cout << "ISBN: "; cin >> temp; d[b].setIsbn(temp); break;
case 3: cout << "Author: "; cin >> temp; d[b].setAuthor(temp); break;
case 4: cout << "Publisher: "; cin >> temp; d[b].setPub(temp); break;
case 5: cout << "Date Added: "; cin >> temp; d[b].setDateAdded(temp); break;
case 6: cout << "Quantity to be Added: "; cin >> t; d[b].setQty(t); break;
case 7: cout << "Wholesale: $"; cin >> td; d[b].setWholesale(td); break;
case 8: cout << "Retail: $"; cin >> td; d[b].setRetail(td); break;

default: trueFalse = true;
}

}

}

void deleteBook(BookData d[])
{
string u = "";
char c = '0';
int b = 0;
cout << "\nEnter the Title or IBSN: ";
cin >> u;
b = findBook(d, u);

if( b == -1 )
{ cout << "\nBook not found."; }
else
{
bookinfo(d, b);
cout << "\nDo you wish to delete this book?(y/n): ";
cin >> c;
if(c == 'y' || c == 'Y')
{
cout << "\nBook has been deleted!";
d[b].removeBook();
}

}
}


//invmenu.h

void invmenu(BookData[], const int);
int findBook(BookData[], string);
void lookUpBook(BookData[]);
void addBook(BookData[]);
void editBook(BookData[]);
void deleteBook(BookData[]);

//reports.cpp

#include<iostream>
#include<iomanip>
#include<string>
#include "reports.h"
#include "bookdata.h"
using namespace std;

void reports ()
{
bool userChoice = false;
while(userChoice == false)
{
int userInput = 0;
bool trueFalse = false;

cout << "\n" << setw(45) << "Serendipity Booksellers\n"
<< setw(38) << "Reports\n\n"
<< "1.Inventory Listing\n"
<< "2.Inventory Wholesale Value\n"
<< "3.Inventory Retail Value\n"
<< "4.Listing by Quantity\n"
<< "5.Listing by Cost\n"
<< "6.Listing by Age\n"
<< "7.Return to the Main Menu\n\n";

do{
cout << "\nEnter your choice: ";
cin >> userInput;

if(userInput >= 1 && userInput <= 7)
{ trueFalse = true; }
else
{ cout << "\nPlease enter a number in the range 1 - 7.\n"; }

}while(trueFalse != true);

switch(userInput)
{
case 1: repListing(); break;
case 2: repWholesale(); break;
case 3: repRetail(); break;
case 4: repQty(); break;
case 5: repCost(); break;
case 6: repAge(); break;
case 7:
userChoice = true;
break;
}
}

}

void repListing(){
cout << "\nYou selected Inventory Listing\n";}
void repWholesale(){
cout << "\nYou selected Inventory Wholesale Value\n";}
void repRetail(){
cout << "\nYou selected Inventory Retail Value\n";}
void repQty(){
cout << "\nYou selected Inventory Listing By Quantity\n";}
void repCost(){
cout << "\nYou selected Inventory Listing By Cost\n";}
void repAge(){
cout << "\nYou selected Inventory Listing By Age\n";}


//reports.h

#include<iostream>
#include<iomanip>
using namespace std;

void reports();
void repListing();
void repWholesale();
void repRetail();
void repQty();
void repCost();
void repAge();

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>
#include<iomanip>
#include<string>
#include "bookdata.cpp"
#include "bookinfo.cpp"
#include "invmenu.cpp"
#include "reports.cpp"
#include "cashier.cpp"
using namespace std;
const int ARRAYNUM = 20;
BookData bookdata[ARRAYNUM];
int main ()
{
bool userChoice = false;
while(userChoice == false)
{
int userInput = 0;
bool trueFalse = false;
cout << "\n" << setw(45) << "Serendipity Booksellers\n"
<< setw(39) << "Main Menu\n\n"
<< "1.Cashier Module\n"
<< "2.Inventory Database Module\n"
<< "3.Report Module\n"
<< "4.Exit\n";
do{
cout << "\nEnter your choice: ";
cin >> userInput;
if(userInput >= 1 && userInput <= 4)
{ trueFalse = true; }
else
{ cout << "\nPlease enter a number in the range 1 - 4.\n"; }
}while(trueFalse != true);
switch(userInput)
{
case 1: cashier(); break;
case 2: invmenu(bookdata,ARRAYNUM); break;
case 3: reports(); break;
case 4:
cout << "\nExiting Program\n\n";
userChoice = true;
break;
}
}
return 0;
}

///////////////////////////////////////////////////////////////////

//bookdata.h
#ifndef bookdata_H
#define bookdata_H
#include<iostream>
#include<iomanip>
using namespace std;
class BookData
{
private:
string bookTitle;
string isbn;
string author;
string publisher;
string dateAdded;
int qtyOnHand;
double wholesale;
double retail;
bool Empty;
public:
BookData();
void setTitle(string);
void setIsbn(string);
void setAuthor(string);
void setPub(string);
void setDateAdded(string);
void setQty(int);
void setWholesale(double);
void setRetail(double);
bool isEmpty();
void insertBook();
void removeBook();
string getTitle();
string getIsbn();
string getAuthor();
string getPub();
string getDateAdded();
int getQty();
double getWholesale();
double getRetail();
};
#endif

////////////////////////////////////////////////////

//bookdata.cpp
#include<iostream>
#include<iomanip>
#include<string>
#include "bookdata.h"
using namespace std;

BookData::BookData()
{
bookTitle = "";
isbn = "";
author = "";
publisher = "";
dateAdded = "";
qtyOnHand = 0;
wholesale = 0;
retail = 0;
Empty = true;
};
void BookData::setTitle(string t)
{ bookTitle = t; };
void BookData::setIsbn(string i)
{ isbn = i; };
void BookData::setAuthor(string a)
{ author = a; };
void BookData::setPub(string p)
{ publisher = p; };
void BookData::setDateAdded(string d)
{dateAdded = d; };
void BookData::setQty(int q)
{ qtyOnHand = q; };
void BookData::setWholesale(double w)
{ wholesale = w; };
void BookData::setRetail(double r)
{ retail = r; };
bool BookData::isEmpty()
{ return Empty; };
void BookData::insertBook()
{ Empty = false; };
void BookData::removeBook()
{ Empty = true; };
string BookData::getTitle()
{ return bookTitle; };
string BookData::getIsbn()
{ return isbn; };
string BookData::getAuthor()
{ return author; };
string BookData::getPub()
{ return publisher; };
string BookData::getDateAdded()
{ return dateAdded; };
int BookData::getQty()
{ return qtyOnHand; };
double BookData::getWholesale()
{ return wholesale; };
double BookData::getRetail()
{ return retail; };

/////////////////////////////////////////////////

//bookinfo.h
#ifndef bookinfo_H
#define bookinfo_H
#include<iostream>
#include<iomanip>
using namespace std;
void bookinfo(BookData[], int);
#endif

////////////////////////////////////////////////////

//bookinfo.cpp

#include<iostream>
#include<iomanip>
#include<string>
#include "bookdata.h"
#include "bookinfo.h"
using namespace std;
void bookinfo (BookData d[], int i)
{
cout << setw(45) << "Serendipity Booksellers\n"
<< setw(42) << "Book Information\n\n";
cout << "\nISBN: " << d[i].getIsbn()
<< "\nTitle: " << d[i].getTitle()
<< "\nAuthor: " << d[i].getAuthor()
<< "\nPublisher: " << d[i].getPub()
<< "\nDate Added: " << d[i].getDateAdded()
<< "\nQuantity-On-Hand: " << d[i].getQty()
<< fixed << setprecision(2)
<< "\nWholesale Cost: $" << d[i].getWholesale()
<< "\nRetail Price: $" << d[i].getRetail() << "\n";
}

////////////////////////////////////////////////////////

//cashier.h
#ifndef cashier_H
#define cashier_H
#include<iostream>
#include<iomanip>
using namespace std;
void cashier();
#endif

///////////////////////////////////////////////////

//cashier.cpp
#include<iostream>
#include<iomanip>
#include<string>
#include "cashier.h"
#include "bookdata.h"
using namespace std;
void cashier ()
{
bool userChoice = false;
while(userChoice == false)
{
string dateBook, codeBook, titleBook;
int numBook;
double priceBook;
cout << "\nSerendipity Booksellers"
<< "\nCashier Module\n\n";
cout << "Date: ";
cin >> dateBook;
cout << "Quantity of Book: ";
cin >> numBook;
cout << "ISBN: ";
cin >> codeBook;
cout << "Title: ";
cin >>titleBook;
cout << "Price: ";
cin >> priceBook;
cout << "\n\n";
cout << "Serendipity Booksellers\n\n"
<< "Date: " << dateBook << "\n\n";
cout << setw(5) << left << "Qty "
<< setw(8) << left << " ISBN "
<< setw(15) << left << " Title "
<< setw(6) << left << " Price "
<< setw(6) << left << " Total\n";
cout << "------------------------------------------\n";
cout << fixed << setprecision(2)
<< setw(5) << numBook
<< setw(8) << codeBook
<< setw(15) << titleBook
<< "$" << setw(6) << priceBook
<< "$" << setw(6) << (numBook * (priceBook * 1.06)) << "\n\n";
cout << "\n" << setw(15) << right << "Subtotal:" << setw(20) << "$" << priceBook
<< "\n" << setw(15) << right << "Tax:" << setw(20) << "$" << (numBook * (priceBook * .06))
<< "\n" << setw(15) << right << "Total:" << setw(20) << "$" << (numBook * (priceBook * 1.06))
<< "\n\nThank You For Shopping Serendipity!\n\n";
char choice;
cout << "\nIs there another transaction that is to be processed?(y/n): ";
cin >> choice;
if( choice == 'n' || choice == 'N' ){userChoice = true;}
}
}

////////////////////////////////////////////////////////

//invmenu.h
#ifndef invmenu_H
#define invmenu_H
void invmenu(BookData[], const int);
int findBook(BookData[], string);
void lookUpBook(BookData[]);
void addBook(BookData[]);
void editBook(BookData[]);
void deleteBook(BookData[]);
#endif

///////////////////////////////////////////////////////

//reports.cpp
#include<iostream>
#include<iomanip>
#include<string>
#include "reports.h"
#include "bookdata.h"
using namespace std;
void reports ()
{
bool userChoice = false;
while(userChoice == false)
{
int userInput = 0;
bool trueFalse = false;
cout << "\n" << setw(45) << "Serendipity Booksellers\n"
<< setw(38) << "Reports\n\n"
<< "1.Inventory Listing\n"
<< "2.Inventory Wholesale Value\n"
<< "3.Inventory Retail Value\n"
<< "4.Listing by Quantity\n"
<< "5.Listing by Cost\n"
<< "6.Listing by Age\n"
<< "7.Return to the Main Menu\n\n";
do{
cout << "\nEnter your choice: ";
cin >> userInput;
if(userInput >= 1 && userInput <= 7)
{ trueFalse = true; }
else
{ cout << "\nPlease enter a number in the range 1 - 7.\n"; }
}while(trueFalse != true);
switch(userInput)
{
case 1: repListing(); break;
case 2: repWholesale(); break;
case 3: repRetail(); break;
case 4: repQty(); break;
case 5: repCost(); break;
case 6: repAge(); break;
case 7:
userChoice = true;
break;
}
}
}
void repListing(){
cout << "\nYou selected Inventory Listing\n";}
void repWholesale(){
cout << "\nYou selected Inventory Wholesale Value\n";}
void repRetail(){
cout << "\nYou selected Inventory Retail Value\n";}
void repQty(){
cout << "\nYou selected Inventory Listing By Quantity\n";}
void repCost(){
cout << "\nYou selected Inventory Listing By Cost\n";}
void repAge(){
cout << "\nYou selected Inventory Listing By Age\n";}

////////////////////////////////////////////////////////////

//invmenu.cpp
#include<iostream>
#include<iomanip>
#include<string>
#include"bookdata.h"
#include"bookinfo.h"
#include"invmenu.h"
using namespace std;
void invmenu(BookData bookdata[], const int NUM)
{
bool userChoice = false;
while(userChoice == false)
{
int userInput = 0;
bool trueFalse = false;
cout << "\n" << setw(45) << "Serendipity Booksellers\n"
<< setw(43) << "Inventory Database\n\n"
<< "1.Look-up a Book\n"
<< "2.Add a Book\n"
<< "3.Edit a Book's Record\n"
<< "4.Delete a Book\n"
<< "5.Return to the Main Menu\n";
do{
cout << "\nEnter your choice: ";
cin >> userInput;
if(userInput >= 1 && userInput <= 5)
{ trueFalse = true; }
else
{ cout << "\nPlease enter a number in the range 1 - 5.\n"; }
}while(trueFalse != true);
switch(userInput)
{
case 1: lookUpBook(bookdata); break;
case 2: addBook(bookdata); break;
case 3: editBook(bookdata); break;
case 4: deleteBook(bookdata); break;
case 5:
userChoice = true;
break;
}
}
}

void lookUpBook(BookData d[])
{
string u = "";
int b = 0;
cout << "\nEnter the Title or IBSN: ";
cin >> u;
b = findBook(d, u);
if( b == -1 )
{ cout << "\nBook not found."; }
else
{bookinfo(d, b); }
}
int findBook(BookData d[], string u)
{
int fb = 0;
for(int i = 0; i < 20; i++)
{
cout << "\nBonk " << i << "\n";
if(u == d[i].getTitle() || u == d[i].getIsbn())
{ fb = i; break; }
else
{fb = -1;}
}
return fb;
}
void addBook(BookData d[])
{
int space;
for(int i = 0; i <= 20; i++)
{
//cout << "\nBonk " << i << "\n";
if(d[i].isEmpty() != false)
{ space = i; break; }
}
if(space != -1)
{
string temp = "";
int t = 0;
double td = 0;
d[space].insertBook();
cout << "Book Title: "; cin >> temp; d[space].setTitle(temp);
cout << "ISBN: "; cin >> temp; d[space].setIsbn(temp);
cout << "Author: "; cin >> temp; d[space].setAuthor(temp);
cout << "Publisher: "; cin >> temp; d[space].setPub(temp);
cout << "Date Added: "; cin >> temp; d[space].setDateAdded(temp);
cout << "Quantity to be Added: "; cin >> t; d[space].setQty(t);
cout << "Wholesale: $"; cin >> td; d[space].setWholesale(td);
cout << "Retail: $"; cin >> td; d[space].setRetail(td);
}
}
void editBook(BookData d[])
{
bool trueFalse = false;
string u = "";
int b = 0;
cout << "\nEnter the Title or IBSN: ";
cin >> u;
b = findBook(d, u);
if( b == -1 )
{ cout << "\nBook not found."; trueFalse = true;}
while(trueFalse != true)
{
bookinfo(d, b);
string temp = "";
int t = 0;
double td = 0;
cout << "\nEdit\n1.Title\n2.ISBN\n3.Author\n4.Publisher\n5.Date Added\n6.Quantity\n7.Wholesale\n"
<< "8.Retail\n9.Exit\n";
bool aaa = false;
do{
cout << "\nEnter your choice: ";
cin >> t;
if(t >= 1 && t <= 9)
{ aaa = true; }
else
{ cout << "\nPlease enter a number in the range 1 - 9.\n"; }
}while(aaa != true);
switch(t)
{
case 1: cout << "Book Title: "; cin >> temp; d[b].setTitle(temp); break;
case 2: cout << "ISBN: "; cin >> temp; d[b].setIsbn(temp); break;
case 3: cout << "Author: "; cin >> temp; d[b].setAuthor(temp); break;
case 4: cout << "Publisher: "; cin >> temp; d[b].setPub(temp); break;
case 5: cout << "Date Added: "; cin >> temp; d[b].setDateAdded(temp); break;
case 6: cout << "Quantity to be Added: "; cin >> t; d[b].setQty(t); break;
case 7: cout << "Wholesale: $"; cin >> td; d[b].setWholesale(td); break;
case 8: cout << "Retail: $"; cin >> td; d[b].setRetail(td); break;
default: trueFalse = true;
}
}
}
void deleteBook(BookData d[])
{
string u = "";
char c = '0';
int b = 0;
cout << "\nEnter the Title or IBSN: ";
cin >> u;
b = findBook(d, u);
if( b == -1 )
{ cout << "\nBook not found."; }
else
{
bookinfo(d, b);
cout << "\nDo you wish to delete this book?(y/n): ";
cin >> c;
if(c == 'y' || c == 'Y')
{
cout << "\nBook has been deleted!";
d[b].removeBook();
}
}
}

////////////////////////////////////////////////

//reports.h
#ifndef reports_H
#define reports_H
#include<iostream>
#include<iomanip>
using namespace std;
void reports();
void repListing();
void repWholesale();
void repRetail();
void repQty();
void repCost();
void repAge();
#endif

/////////////////////////////////////////////////////////////

Add a comment
Know the answer?
Add Answer to:
my program wont run on my computer and im not understanding why. please help. #include<iostream> #include<iomanip>...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • #include<iostream> #include<string> #include<iomanip> using namespace std; /* ********* Class Car ************* ********************************* */ class Car {...

    #include<iostream> #include<string> #include<iomanip> using namespace std; /* ********* Class Car ************* ********************************* */ class Car { private: string reportingMark; int carNumber; string kind; bool loaded; string choice; string destination; public: Car() { reportingMark = ""; carNumber = 0; kind = "Others"; loaded = 0; destination = "NONE"; } ~Car() { } void setUpCar(string &reportingMark, int &carNumber, string &kind, bool &loaded, string &destination); }; void input(string &reportingMark, int &carNumber, string &kind, bool &loaded,string choice, string &destination); void output(string &reportingMark, int &carNumber,...

  • fully comments for my program, thank you will thumb up #include <iostream> #include <fstream> #include <string>...

    fully comments for my program, thank you will thumb up #include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; struct book { int ISBN; string Author; string Title; string publisher; int Quantity; double price; }; void choice1(book books[], int& size, int MAX_SIZE) { ifstream inFile; inFile.open("inventory.txt"); if (inFile.fail()) cout <<"file could not open"<<endl; string str;    while(inFile && size < MAX_SIZE) { getline(inFile, str); books[size].ISBN = atoi(str.c_str()); getline(inFile, books[size].Title);    getline(inFile, books[size].Author); getline(inFile, books[size].publisher);          getline(inFile,...

  • im not sure why my code isnt working? include <iostream> #include <iomanip> using namespace std; int...

    im not sure why my code isnt working? include <iostream> #include <iomanip> using namespace std; int main() { int amountOfCoffee; double Price; char salesTaxChargeability; double TotalAmount; const double SALESTAX = 0.035; // 3.5 % cout << "\nEnter the number of pounds of coffee ordered in Pounds :"; cin >> amountOfCoffee; cout << "\nEnter the price of coffee per Pound :"; cin >> Price; cout << "\nIs sales tax Chargeable (y or n): "; cin >> salesTaxChargeability; if ( (salesTaxChargeability ==...

  • c++, I am having trouble getting my program to compile, any help would be appreciated. #include...

    c++, I am having trouble getting my program to compile, any help would be appreciated. #include <iostream> #include <string> #include <string.h> #include <fstream> #include <stdlib.h> using namespace std; struct record { char artist[50]; char title[50]; char year[50]; }; class CD { //private members declared private: string artist; //asks for string string title; // asks for string int yearReleased; //asks for integer //public members declared public: CD(); CD(string,string,int); void setArtist(string); void setTitle(string); void setYearReleased(int); string getArtist() const; string getTitle() const; int...

  • I need a detailed pseudocode for this code in C ++. Thank you #include <iostream> #include...

    I need a detailed pseudocode for this code in C ++. Thank you #include <iostream> #include <string> #include <iomanip> using namespace std; struct Drink {    string name;    double cost;    int noOfDrinks; }; void displayMenu(Drink drinks[], int n); int main() {    const int size = 5;       Drink drinks[size] = { {"Cola", 0.65, 2},    {"Root Beer", 0.70, 1},    {"Grape Soda", 0.75, 5},    {"Lemon-Lime", 0.85, 20},    {"Water", 0.90, 20} };    cout <<...

  • The following is a sample inventory in C++, i want to ask the user to input a item number for removing from inventory. //CPP #include <iostream> #include <fstream> #include <cstdlib>...

    The following is a sample inventory in C++, i want to ask the user to input a item number for removing from inventory. //CPP #include <iostream> #include <fstream> #include <cstdlib> #include <iomanip> #define MAX 1000 using namespace std; //Function to Add a new inventory item to the data into the array in memory void addItem(string desc[],string idNum[], float prices[], int qty[],int &num) { cout<<"Enter the names:"; cin>>desc[num]; cout<<"Enter the item number:"; cin>>idNum[num]; cout<<"Enter the price of item:"; cin>>prices[num]; cout<<"Enter the...

  • CODES: main.cpp #include <iostream> #include <string> #include "ShoppingCart.h" using namespace std; char PrintMenu() { char answer;...

    CODES: main.cpp #include <iostream> #include <string> #include "ShoppingCart.h" using namespace std; char PrintMenu() { char answer; cout << "MENU" << endl; cout << "a - Add item to cart" << endl; cout << "d - Remove item from cart" << endl; cout << "c - Change item quantity" << endl; cout << "i - Output items' descriptions" << endl; cout << "o - Output shopping cart" << endl; cout << "q - Quit" << endl << endl; while (true) {...

  • CAN YU HELP ME CONSTRUCT A FLOW CHART FOR THE FOLLOW PROGRAM ? C++ CODE: #include<iostream>...

    CAN YU HELP ME CONSTRUCT A FLOW CHART FOR THE FOLLOW PROGRAM ? C++ CODE: #include<iostream> using namespace std; int main() { //declaring variable num int num; //prompting user to enter a number cout<<"Input a number to check prime or not:"; //reading input from user cin>>num; //loop to check user input for positive number while(num<0) { cout<<"Error! Positive Integers Only.\n"; cout<<"Input a number to check prime or not:"; cin>>num; } //initializing isPrime variable with false bool isPrime = true; //loop...

  • Can anyone help me with my C++ assignment on structs, arrays and bubblesort? I can't seem...

    Can anyone help me with my C++ assignment on structs, arrays and bubblesort? I can't seem to get my code to work. The output should have the AVEPPG from highest to lowest (sorted by bubbesort). The output of my code is messed up. Please help me, thanks. Here's the input.txt: Mary 15 10.5 Joseph 32 6.2 Jack 72 8.1 Vince 83 4.2 Elizabeth 41 7.5 The output should be: NAME             UNIFORM#    AVEPPG Mary                   15     10.50 Jack                   72      8.10 Elizabeth              41      7.50 Joseph                 32      6.20 Vince                  83      4.20 ​ My Code: #include <iostream>...

  • Can somebody help me with this coding the program allow 2 players play tic Tac Toe....

    Can somebody help me with this coding the program allow 2 players play tic Tac Toe. however, mine does not take a turn. after player 1 input the tow and column the program eliminated. I want this program run until find a winner. also can somebody add function 1 player vs computer mode as well? Thanks! >>>>>>>>>>>>>Main program >>>>>>>>>>>>>>>>>>>>>>> #include "myheader.h" int main() { const int NUM_ROWS = 3; const int NUM_COLS = 3; // Variables bool again; bool won;...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT