Advertisement
Guest User

Untitled

a guest
Dec 29th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #include <math.h>
  4.  
  5. #include <stdlib.h>
  6.  
  7. int main () {
  8.  
  9. char str[8];
  10.  
  11. char alph[] = "QWERTYUIOPLKJHGFDSAZXCVBNM";
  12.  
  13. for(int i = 0; i < 8; i++){
  14.  
  15. fflush(stdin);
  16.  
  17. scanf("%c", &str[i]);
  18.  
  19. }
  20.  
  21. for(int i = 0; i < 8; i++)
  22.  
  23. printf("[%c]", str[i]);
  24.  
  25. puts("");
  26.  
  27. for (int i = 0; i < 8; i++)
  28.  
  29. printf ("{%o} ", str[i]);
  30.  
  31. puts("");
  32.  
  33. for(int i = 0, j = 0; i < 53 , j < 8; i++){
  34.  
  35. if(str[j] == alph[i]){
  36.  
  37. str[j] &= ~(1 << 3);
  38.  
  39. j++;
  40.  
  41. }
  42.  
  43. else{
  44.  
  45. str[j] |= (1 << 8);
  46.  
  47. j++;
  48.  
  49. }
  50.  
  51. }
  52.  
  53. for(int i = 0; i < 8; i++)
  54.  
  55. printf("[%c]", str[i]);
  56.  
  57. puts("");
  58.  
  59. for (int i = 0; i < 8; i++)
  60.  
  61. printf ("{%o}", str[i]);
  62.  
  63. return 0;
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement