int SafeCapture (const char errorChar[50]);
int main(){
int dimention, dimLimChar;
char str[50];
dimention = SafeCapture;
cout << "-------------------------------------------------\n"
<< "This console application draws some figures like\n"
<< "hourglass, rhomb, bow and a rummer. Both of them\n"
<< "shows filled or void.\n"
<< "-------------------------------------------------\n\n";
dimLimChar = sprintf(str, "The next request needs a number between %d and %d.", DIMMIN, DIMMAX);
}
#include <limits>
int SafeCapture (const char errorChar[50]){
int dimention;
while (true){
cout << "\nPlease, enter the dimention what you want: ";
cin >> dimention;
if (cin.bad()){
cout << "UNRECOVERABLE SYSTEM FAIL: Console application will close now.\n";
exit(1);
}
if (cin.fail()){
cout << "ERROR, This is not a number... Please try again.\n";
cin.clear();
cin.ignore(numeric_limits<int>::max(),'\n');
continue;
}
break;
}
return dimention;
}