#include #include using namespace std; int main () { int hits {0}; int atbats {0}; cout << "How many hits?\n"; cin >> hits; if (!cin){ cerr << "Sorry, that is not a whole number.\n"; return EXIT_FAILURE; } cout << "How many at bats?\n"; cin >> atbats; if (!cin){ cerr << "Sorry, that is not a whole number.\n"; return EXIT_FAILURE; } const double average {static_cast(hits) / atbats}; cout << "You have a batting average of " << average << "\n"; return EXIT_SUCCESS; }