Advertisement
Verzingz

C++ Shooping Application, not working D:

Jul 8th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <string>
  4. #include <sstream>
  5. #include <vector>
  6.  
  7. bool Finished = false;
  8.  
  9. int SetConsoleAttributes() {
  10.     SetConsoleTitleA("Shopping Cart - C++ Edition");
  11.     ShowWindow(GetConsoleWindow(), SW_MAXIMIZE);
  12.  
  13.     return 0;
  14. }
  15.  
  16. int main(int argv, char** argc) {
  17.     std::vector<std::string> Items;
  18.     std::vector<float> itemPrice;
  19.  
  20.     std::string Total;
  21.     std::string itemInput;
  22.  
  23.     int priceInput;
  24.  
  25.     while (!Finished) {
  26.         std::cout << "Type 'Done' to Show The Results..." << std::endl << std::endl;
  27.         std::cout << "Add Item: ";
  28.         std::cin >> itemInput;
  29.         std::cout << itemInput << " Price: ";
  30.         std::cin >> priceInput;
  31.  
  32.         if (itemInput == "DONE" || itemInput == "Done" || itemInput == "done")
  33.             Finished = true;
  34.  
  35.         for (int i = 0; i < Items.size(); i++) {
  36.             Items.push_back(itemInput);
  37.  
  38.             for (int j = 0; j < itemPrice.size(); i++) {
  39.                 itemPrice.push_back(priceInput);
  40.             }
  41.         }
  42.     }
  43.  
  44.     // Converting Price To String
  45.     std::string convertPTS;
  46.     std::stringstream putInString;
  47.  
  48.     putInString << priceInput;
  49.     putInString >> convertPTS;
  50.  
  51.     // Print Total
  52.     for (int i = 0; i < Items.size(); i++) {
  53.         std::cout << "Item: " << Items[i];
  54.     }
  55.  
  56.     system("pause");
  57.  
  58.     return 0;
  59. }
  60.  
  61. // Set Console Attributes Before Main
  62. class SCAF {
  63. public:
  64.     static int SCA;
  65. };
  66.  
  67. int SCAF::SCA = SetConsoleAttributes();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement