nocturnalmk

komp_bin()

Apr 8th, 2012
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. char *komp_bin(char br[]) {
  2.  
  3.     char c;
  4.     int  l = strlen(br);
  5.     int i = 0;
  6.     char nov[l+1];
  7.  
  8.     while ((c = br[i]) != '\0') {
  9.         if (c == '0') {
  10.             nov[i] = '1';
  11.         } else {
  12.             nov[i] = '0';
  13.         }
  14.  
  15.         i++;
  16.     }
  17.  
  18.     nov[i+i] = '\0';
  19.  
  20.     cout << nov;
  21.  
  22.     return nov;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment