this is part of a function that I am working on I am getting it to work but now I need to make it display "Error" if user enters a non numeric value for both Miles and Gallons but I have no idea where to start please help.
if (!(cin >> Miles)) {
std::cout << "Error";
return 1;
}
//or
cin >> Miles;
if (cin.fail()) {//Or !cin, however they not actually the same thing
//...
}