Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <string>
- #include <sstream>
- #include <vector>
- bool Finished = false;
- int SetConsoleAttributes() {
- SetConsoleTitleA("Shopping Cart - C++ Edition");
- ShowWindow(GetConsoleWindow(), SW_MAXIMIZE);
- return 0;
- }
- int main(int argv, char** argc) {
- std::vector<std::string> Items;
- std::vector<float> itemPrice;
- std::string Total;
- std::string itemInput;
- int priceInput;
- while (!Finished) {
- std::cout << "Type 'Done' to Show The Results..." << std::endl << std::endl;
- std::cout << "Add Item: ";
- std::cin >> itemInput;
- std::cout << itemInput << " Price: ";
- std::cin >> priceInput;
- if (itemInput == "DONE" || itemInput == "Done" || itemInput == "done")
- Finished = true;
- for (int i = 0; i < Items.size(); i++) {
- Items.push_back(itemInput);
- for (int j = 0; j < itemPrice.size(); i++) {
- itemPrice.push_back(priceInput);
- }
- }
- }
- // Converting Price To String
- std::string convertPTS;
- std::stringstream putInString;
- putInString << priceInput;
- putInString >> convertPTS;
- // Print Total
- for (int i = 0; i < Items.size(); i++) {
- std::cout << "Item: " << Items[i];
- }
- system("pause");
- return 0;
- }
- // Set Console Attributes Before Main
- class SCAF {
- public:
- static int SCA;
- };
- int SCAF::SCA = SetConsoleAttributes();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement