seberm

prevodnik

Oct 27th, 2010
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main(int argc, char* argv[]) {
  8.    
  9.     cout << "\n";
  10.    
  11.     if (argc != 2) {
  12.         cout << "Bad parameter\n";
  13.         return 1;
  14.     }
  15.  
  16.    
  17.     int size = strlen(argv[argc-1]);
  18.    
  19.     cout << "char(";
  20.     for (int i = 0; i < size; i++) {
  21.    
  22.         cout << static_cast<int>(argv[argc-1][i]);
  23.        
  24.         if (i != (size-1))
  25.             cout << ",";
  26.     }
  27.     cout << ")";
  28.    
  29.     cout << "\n\n";
  30.    
  31.     return 0;
  32. }
Add Comment
Please, Sign In to add comment