Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <cmath>
  4. #include <fstream>
  5. using namespace std;
  6.  
  7. int main(int argc, char** argv) {
  8.     const char *wejscie;
  9.     const char *wyjscie;
  10.     if (argc != 5) {
  11.         cout << "blad parametrow";
  12.         return 0;
  13.     }
  14.         /*if(strcmp(argv[1],"-i") == 0) {
  15.             wejscie = argv[2];
  16.             wyjscie = argv[4];
  17.         } else if (strcmp(argv[1],"-o") == 0) {
  18.                 wejscie = argv[4];
  19.                 wyjscie = argv[2];
  20.             } else {
  21.                 cout <<"blad parametrow";
  22.                 return 0;
  23.             }
  24. cout <<wejscie<<' '<<wyjscie;
  25. */
  26.    for(int i=1;i<=argc;i++) {
  27.         if (strcmp(argv[i], "-i") == 0){
  28.             wejscie = argv[i+1];
  29.     } else if(strcmp(argv[i],"-o") == 0) {
  30.             wyjscie = argv[i+1];
  31.         }
  32.     }cout<<wejscie<<' '<<wyjscie ;
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement