Advertisement
dllbridge

Untitled

Jul 23rd, 2023 (edited)
874
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1.  
  2.  
  3.  
  4. #include   <stdio.h>
  5. #include  <string.h>
  6. #include  <locale.h>
  7. #include  <iostream>      //  здесь "живёт" setlocale(LC_ALL, "rus");
  8. using namespace std;
  9.  
  10.  
  11.  
  12. char* hex_16(const char *psz);
  13.  
  14. char  a[256];
  15.    
  16. int   n  = 0;
  17.  
  18.  
  19. ////////////////////////////////////////////////////////
  20. int main()
  21. {
  22.    
  23.     cin >> a;
  24.                                                                
  25.     printf("%s", hex_16(a) );
  26.        
  27. return 0;
  28. }
  29.  
  30.  
  31. ////////////////////////////////////////////////////////  const
  32. char* hex_16(const char *psz)
  33. {
  34.    
  35.     int i = 0;
  36.    
  37.     static  char sz[256];
  38.    
  39.     char sz1[3];
  40.    
  41.     while(psz[i] != 0)
  42.     {
  43.       sprintf(sz1, "%X", psz[i]);
  44.    
  45.       strcat(sz, sz1);
  46.      
  47.       i++;    
  48.     }
  49.    
  50.    
  51. return sz; 
  52. }
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement