#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;
void getnumSold(vector<int>&);
void getProdNum(int &);
void Bsearch(int[], int size, int num, int &);
//void displayProd(vector<int>&);
const int Row = 9, ProdCol = 31;
char Prod[Row][ProdCol] = { {"Six Steps to Leadership"}, {"Six Steps to Leadership"}, {"Road to Exellence"},
{"Seven Lessons of Quality"},{"Seven Lessons of Quality"},{"Seven Lessons of Quality"},
{"Teams Are Made, Not Born"}, {"Leadership for the Future"}, {"Leadership for the Future"} };
char Desc[Row][ProdCol] = { {"Book"}, {"Audio CD"}, {"DVD"},
{"Book"}, {"Audio CD"}, {"DVD"},
{"Book"}, {"Book"}, {"Audio CD"} };
float Price[] = { 12.95, 14.95, 18.95, 16.95,
21.95, 31.95, 14.95, 14.95, 16.95 };
int pnAr[] = { 914, 915, 916, 915, 918,// 0, 1, 2, 3, 4
919, 920, 921, 922 };// 5, 6, 7, 8
vector<int>DefaultNSold = { 842, 416, 127, 514, 437, 269, 97, 492, 212 };
int main()
{
char key = 'A';
vector<int>Sold(DefaultNSold.size());//receive number sold for each item.
int partNum;// part number of the book from customer.
getnumSold(Sold);//passing vector Sold to function getnumSold().
count << "In main return from getnumSold Sold = {";
for (int i = 0; i < 9; i++)
count << Sold[i] << " ";
count << "} \n\n";
//displayProd(Sold);//Show all the tittles of the items
return 0;
}
/*void displayProd(vector<int>&Sold)// display the table of selections and price.
{
count << left << setw(35) << " Product" << setw(15) << "Decription" << setw(10) << "Part num" <<
setw(15) << " Price" << setw(10) << "sold" << "\n\n";
for (int line = 0; line < Row; line++)
{
count << " " << left << setw(35) << Prod[line] << left << setw(15) <<
Desc[line] << setw(10) << pnAr[line] << "$" << Price[line] <<
right << setw(10) << Sold[line] << "\n\n";
}
}*/
void getnumSold(vector<int>& numSold)
{
char select;
count << " Enter y to use default numbers, any other character";
count << "for entering 6 new numbers: "; cin >> select;
if ((select == 'y') || (select == 'Y'))
{
int row=1;
vector<int>numSold(DefaultNSold);
count << " In getnumSold, You chose to use default = {";
for (row = 1; row < DefaultNSold.size(); row++)
{
count << numSold[row - 1] << " ";
}
count << numSold[row - 1] << "}\n\n";
}
else
{
count << " You chose to enter 9 new sales number.\n\n";
count << "Enter number sold for the following\n\n";
for (int row = 1; row <= DefaultNSold.size(); row++)
{
count << " " << left << setw(35) << Prod[Row-1] << left <<
setw(15) << Desc[row-1] << "$" << Price[row-1] << " is: ";
cin >> numSold[row-1];
}
}
}