Advertisement
Guest User

Untitled

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