//getData function ~ validates that the input is of the correct data type
template<class T>
void getData(T data, string prompt)
{
T input;
for(;;)
{
cout << prompt; cin >> input;
if(cin.good())
break;
cout << "Error: bad input. Try again.\n";
cin.clear();
cin.ignore(10);
}
data = input;
}
Friday Night Open Thread: Motivation
4 hours ago
No comments:
Post a Comment