Guest User

Untitled

a guest
Aug 24th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. Б[0]=A[0];
  2. Б[0]+=A[0+1];
  3. Б[0]+=A[0+2];
  4.  
  5. QByteArray m = ui->lineEdit->text().toLatin1().data();
  6.  
  7. unsigned char ch[9];
  8.  
  9. for(int i =0; i<12; ++i)
  10. {
  11. if(m[i]==' ')
  12. m[i]=m[i+1];
  13. ch[i]=m[i];
  14. ch[i]+=m[i+1];
  15. ch[i]+=m[i+2];
  16.  
  17. }
  18.  
  19. QRegExp val(" ");
  20. QString newStr = str.replace(val, QString(""));
  21.  
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <string.h>
  25.  
  26. int main(int argc, char const *argv[]) {
  27. const char * a = "001 010 010 000";
  28. char * b = calloc(1, sizeof(char));
  29.  
  30. int j = 1;
  31.  
  32. for (int i = 0; i < strlen(a); i++) {
  33. if (a[i] != ' ') {
  34. b = realloc(b, j*sizeof(char));
  35. b[j-1] = a[i];
  36. j++;
  37. }
  38. }
  39.  
  40. b[j-2] = '';
  41.  
  42. printf("%sn%sn", a, b);
  43.  
  44. return 0;
  45. }
Add Comment
Please, Sign In to add comment