Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. #include <cmath>
  5.  
  6. using namespace std;
  7.  
  8. char again;
  9. const int arraysize = 10;
  10.  
  11. string shopitems[arraysize] = {"Milk", "Bread", "Chocolate", "Towel", "Toothpaste", "Soap", "Pen", "Biscuits", "lamp", "Battery"};
  12. string Barcode[arraysize] = {"0120001", "0120002", "0120003", "0120004", "0120005", "0120006", "0120007", "0120008", "0120009", "0120010"};
  13. float price[arraysize] = {10.50, 5.50, 8.00, 12.10, 6.75, 5.20, 2.00, 4.45, 20.50, 10.00};
  14.  
  15.  
  16. int main()
  17. {
  18.  
  19.  
  20. cout <<"********************************************" << endl;
  21. cout <<"* Welcome to the Zeus Shopping program. *" << endl;
  22. cout <<"*Please Scan or enter the barcode Manually *" << endl;
  23. cout <<"********************************************" << endl;
  24.  
  25. string barcodeenter;
  26.  
  27. cout << "Enter a Barcode(press 'f' to finish):";
  28. cin >> barcodeenter;
  29.  
  30. do
  31. {
  32. cout << "New customer (y/n)" << endl;
  33. cin >> again;
  34.  
  35. if (again == 'y'||again == 'Y');
  36. system("pause"); //loop made to ask if they want to start a new sale
  37.  
  38. char answer = 'F','f';
  39. int num = 0;
  40. cout << "Press 'f' to Finish the program." << endl;
  41. while (answer)
  42. }
  43.  
  44. if (barcodeenter == Barcode[0])
  45. {
  46. cout << shopitems[0] << " " << setprecision(4) << showpoint << price[0] << endl;
  47. }
  48. if (barcodeenter == Barcode[1])
  49. {
  50. cout << shopitems[1] << " " << setprecision(3) << showpoint << price[1] << endl;
  51. }
  52. if (barcodeenter == Barcode[2])
  53. {
  54. cout << shopitems[2] << " " << setprecision(3) << showpoint << price[2] << endl;
  55. }
  56. if (barcodeenter == Barcode[3])
  57. {
  58. cout << shopitems[3] << " " << setprecision(4) << showpoint << price[3] << endl;
  59. }
  60. if (barcodeenter == Barcode[4])
  61. {
  62. cout << shopitems[4] << " " << setprecision(3) << showpoint << price[4] << endl;
  63. }
  64. if (barcodeenter == Barcode[5])
  65. {
  66. cout << shopitems[5] << " " << setprecision(3) << showpoint << price[5] << endl;
  67. }
  68. if (barcodeenter == Barcode[6])
  69. {
  70. cout << shopitems[6] << " " << setprecision(3) << showpoint << price[6] << endl;
  71. }
  72. if (barcodeenter == Barcode[7])
  73. {
  74. cout << shopitems[7] << " " << setprecision(3) << showpoint << price[7] << endl;
  75. }
  76. if (barcodeenter == Barcode[8])
  77. {
  78. cout << shopitems[8] << " " << setprecision(4) << showpoint << price[8] << endl;
  79. }
  80. if (barcodeenter == Barcode[9])
  81. {
  82. cout << shopitems[9] << " " << setprecision(4) << showpoint << price[9] << endl;
  83. }
  84. if (barcodeenter == Barcode[10])
  85. {
  86. cout << shopitems[10] << " " << setprecision(4) << showpoint << price[10] << endl;
  87. }
  88.  
  89. //char answer = 'F','f';
  90. //int num = 0;
  91. //cout << "Press 'f' to close the program." << endl;
  92. //while (answer)
  93.  
  94. return 0;
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement