I’m a beginning C++ programmer and this is only my second program... It’s a simple money converter between dollars and Euros. The problem I have is that if I put in a NaN value, it’ll say so and ask again but quit. Does anyone know how to make it wait until the user types something else? Also at the second cin >> user_dollar I’m getting an error that says “Reference to overloaded function could not be resolved; did you mean to call it?” Sorry that this is so long and thanks~
Here is my code. I’m using Xcode on my MacBook Pro.
#include <iostream>
using namespace std;
int main() {
    string choice;
    int user_dollar;
    int user_euro;
    cout << "Dollars to Euros (type ‘Dollars’) or Euros to dollars (type ‘Euros’)? ";
    cin >> choice;
    if (choice == "Dollars" || choice == "dollars") {
        cout << "Enter dollar amount: ";
        cin >> user_dollar;
            if (isdigit(user_dollar) != true){
                cout << "That’s not a number... " << endl;
                cout << "Enter dollar amount: " << endl;
                *cin >> user_dollar;*
                }
            else {
                cout << "That is " << user_dollar / 1.13 << " Euros." << endl;
                }
    }
    else if (choice == "Euros" || choice == "euros") {
        cout << "Enter Euro amount: ";
        cin >> user_euro;
        cout << "That is " << user_euro * 0.89 << " dollars." << endl;
    }
}
 
     
     
     
    