Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iostream>
- #include <iomanip>
- #include <string>
- #include <cmath>
- using namespace std;
- char again;
- const int arraysize = 10;
- string shopitems[arraysize] = { "Milk", "Bread", "Chocolate", "Towel", "Toothpaste", "Soap", "Pen", "Biscuits", "lamp", "Battery" };
- string Barcode[arraysize] = { "0120001", "0120002", "0120003", "0120004", "0120005", "0120006", "0120007", "0120008", "0120009", "0120010" };
- float price[arraysize] = { 10.50, 5.50, 8.00, 12.10, 6.75, 5.20, 2.00, 4.45, 20.50, 10.00 };
- void checkitem(int itemnumber)
- int main()
- {
- cout << "********************************************" << endl;
- cout << "* Welcome to the Zeus Shopping program. *" << endl;
- cout << "*Please Scan or enter the barcode Manually *" << endl;
- cout << "********************************************" << endl;
- string barcodeenter;
- cout << "Enter a Barcode(press 'f' to finish):";
- cin >> barcodeenter;
- char answer = 'F';
- do
- {
- cout << "New customer (y/n)" << endl;
- cin >> again;
- if (again == 'y' || again == 'Y');
- system("pause"); //loop made to ask if they want to start a new sale
- int num = 0;
- cout << "Press 'f' to Finish the program." << endl;
- } while (answer);
- if (barcodeenter == Barcode[0])
- {
- cout << shopitems[0] << " " << setprecision(4) << showpoint << price[0] << endl;
- }
- if (barcodeenter == Barcode[1])
- {
- cout << shopitems[1] << " " << setprecision(3) << showpoint << price[1] << endl;
- }
- if (barcodeenter == Barcode[2])
- {
- cout << shopitems[2] << " " << setprecision(3) << showpoint << price[2] << endl;
- }
- if (barcodeenter == Barcode[3])
- {
- cout << shopitems[3] << " " << setprecision(4) << showpoint << price[3] << endl;
- }
- if (barcodeenter == Barcode[4])
- {
- cout << shopitems[4] << " " << setprecision(3) << showpoint << price[4] << endl;
- }
- if (barcodeenter == Barcode[5])
- {
- cout << shopitems[5] << " " << setprecision(3) << showpoint << price[5] << endl;
- }
- if (barcodeenter == Barcode[6])
- {
- cout << shopitems[6] << " " << setprecision(3) << showpoint << price[6] << endl;
- }
- if (barcodeenter == Barcode[7])
- {
- cout << shopitems[7] << " " << setprecision(3) << showpoint << price[7] << endl;
- }
- if (barcodeenter == Barcode[8])
- {
- cout << shopitems[8] << " " << setprecision(4) << showpoint << price[8] << endl;
- }
- if (barcodeenter == Barcode[9])
- {
- cout << shopitems[9] << " " << setprecision(4) << showpoint << price[9] << endl;
- }
- if (barcodeenter == Barcode[10])
- {
- cout << shopitems[10] << " " << setprecision(4) << showpoint << price[10] << endl;
- }
- //char answer = 'F','f';
- //int num = 0;
- //cout << "Press 'f' to close the program." << endl;
- //while (answer)
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement