diff options
| author | rPatrickWarner <[email protected]> | 2024-04-12 16:13:45 -0700 |
|---|---|---|
| committer | rPatrickWarner <[email protected]> | 2024-04-12 16:13:45 -0700 |
| commit | 02d7a3b8a7d85b57728743a9aafe73ce4b5f7172 (patch) | |
| tree | ae7dece43f1d4d06ce933eec842f8ba593003f81 /CST 126/Homework 1/Helper.hpp | |
| parent | Currency Complete (diff) | |
| download | homework-1-reecepwarner-02d7a3b8a7d85b57728743a9aafe73ce4b5f7172.tar.xz homework-1-reecepwarner-02d7a3b8a7d85b57728743a9aafe73ce4b5f7172.zip | |
minor changes to currency
Diffstat (limited to 'CST 126/Homework 1/Helper.hpp')
| -rw-r--r-- | CST 126/Homework 1/Helper.hpp | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/CST 126/Homework 1/Helper.hpp b/CST 126/Homework 1/Helper.hpp index e82f5e8..abb1a10 100644 --- a/CST 126/Homework 1/Helper.hpp +++ b/CST 126/Homework 1/Helper.hpp @@ -6,12 +6,56 @@ using std::streamsize; constexpr size_t MAX_STREAM_SIZE = numeric_limits<streamsize>::max(); void UserMenu(); -int RandomNumberGenerator(const int& LowerBound, const int& UpperBound); - double InputDouble(const char* Prompt); int InputSelectionInt(const char* Prompt); void Prompts(const char* Prompt); +void Prompts(const char* Prompt) +{ + std::cout << Prompt; +} + +double InputDouble(const char* Prompt) +{ + std::cout << Prompt << std::endl; + + std::cout.flush(); + + double Value = 0; + std::cin >> Value; + + while (!std::cin) + { + std::cout << Prompt << std::endl; + std::cin.clear(); + + std::cin.ignore(MAX_STREAM_SIZE, '\n'); + std::cin >> Value; + + } + return Value; +} + +int InputSelectionInt(const char* Prompt) +{ + std::cout << Prompt << std::endl; + + std::cout.flush(); + + int Value = 0; + std::cin >> Value; + + while (!std::cin) + { + std::cout << Prompt << std::endl; + std::cin.clear(); + + std::cin.ignore(MAX_STREAM_SIZE, '\n'); + std::cin >> Value; + + } + return Value; +} #endif
\ No newline at end of file |