C++ [9999] Question
#include <iostream> #include <string> using namespace std; int main () { int userInput; bool trueValue = true; cout << "Welcome to the Calculator that can only count up to 4 digits." << endl; cout << "If you would like to view the current sum, please type [TOTAL]" << endl; cout << "Enter 9999 to [EXIT]." << endl; while ((userInput < 9999 || userInput == "TOTAL") && trueValue) { if (userInput == "TOTAL") { cout << userInput << endl; } else { cout << "Please enter a number:" << endl; cin >> userInput; if (userInput == 9999) { trueValue = false; } else { trueValue = true; userInput += userInput; } } return 0; } } How would I be able to compare both a integer and string for my condition, I'm thinking of parsing the input but I'm not sure how.