-f の後のオプション/引数が 0 から 9 の間の数値であることを確認したいと思います。任意の順序で、合計 10 個の引数が必要です。唯一の条件は、-f の後に数字が続く必要があることです。
/* Ensure that the -f option is included in the arguments
and it is preceeded by valid digit between 0 -9 */
int Crypto::offsetValidation( int argc, char *argv[] )
{
for( int i = 0; i < argc; i++ )
{
if(argv[i] == string("-f"))
{
cout << "offset" << endl;
return offset;
}
}
cout << "Usage: -f is required for offset" << endl;
exit(EXIT_FAILURE);
return 0;
}