Advertisement
dykow

args

Jan 25th, 2019
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. int main(int argc, char *argv[])
  2. {
  3.     // parameters variables
  4.     string input = "", output = "", dictionary = "", direction = "";
  5.  
  6.     // checking main arguments
  7.     for (int i = 1; i < argc; i++)
  8.     {
  9.         string argument = argv[i];
  10.         if (argument == "-i")
  11.             input = argv[i + 1];
  12.         else if (argument == "-s")
  13.             dictionary = argv[i + 1];
  14.         else if (argument == "-o")
  15.             output = argv[i + 1];
  16.         else if (argument == "-k")
  17.             direction = argv[i + 1];
  18.         else if (argument == "-h")
  19.         {
  20.           cerr <<
  21.               "-i input text file \n" <<
  22.               "-o output text file \n" <<
  23.               "-s dictionary text file \n" <<
  24.               "-k translation diretion enpl/plen \n";
  25.  
  26.           return 0;
  27.         }
  28.     }
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement