Instead of:
cin >> accNum;
cin.ignore(numeric_limits<int>::max(), '\n');
while ((!cin || cin.gcount() != 1)) {
cin.clear();
cin.ignore(100, '\n');
cout << "Not an acceptable account number. Please try again." << endl;
cin >> accNum;
}
could you just write:
while (!(cin >> accNum)) {
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), '\n');
cout << "Not an acceptable account number. Please try again." << endl;
}
Not only would that be much shorter, it would also work as desired.