fork download
  1. #include<stdio.h>
  2.  
  3. unsigned long long int type0(char *str,unsigned int UI,unsigned short US,char *c)
  4. {
  5. unsigned long long int answer = 0;
  6. int bit = 64;
  7. int count_c = 0;
  8. for(int i = 0;i < 4;i ++)
  9. {
  10. printf("str[%d] = %c\n",i,str[i]);
  11. unsigned long long int UI_shift;
  12. unsigned long long int US_shift;
  13. unsigned long long int c0_shift;
  14. unsigned long long int c1_shift;
  15.  
  16.  
  17. if (str[i] == 'L')
  18. {
  19. UI_shift = (UI << (bit - 32));
  20. printf("UI = ");
  21. for (int i = 0;i < 32;i ++)
  22. {
  23. int bit_test;
  24. bit_test = UI & 1;
  25. printf("%d",bit_test);
  26. UI >>= 1;
  27. }
  28. printf("\n");
  29. bit -= 32;
  30. }
  31. else if (str[i] == 'S')
  32. {
  33. US_shift = (US << (bit - 16));
  34. printf("US = ");
  35. for (int i = 0;i < 16;i ++)
  36. {
  37. int bit_test;
  38. bit_test = US & 1;
  39. printf("%d",bit_test);
  40. US >>= 1;
  41. }
  42. printf("\n");
  43. bit -= 16;
  44. }
  45. else if (str[i] == 'C' && count_c == 0)
  46. {
  47. c0_shift = (c[0] << (bit - 8));
  48. bit -= 8;
  49. count_c ++;
  50. }
  51. else
  52. {
  53. c1_shift = (c[1] << (bit - 0));
  54. bit -= 8;
  55. }
  56. }
  57. answer = UI_shift + UI_shift + c0_shift + c1_shift;
  58. return answer;
  59. }
  60.  
  61. int main()
  62. {
  63. int task_type;
  64. scanf("%d",&task_type);
  65.  
  66. if (task_type == 0)
  67. {
  68. char str[5];
  69. scanf("%s",str);
  70. //printf("%s",str);
  71.  
  72. unsigned long long int ULLI;
  73. unsigned int UI;
  74. scanf("%u", &UI);
  75. unsigned short US;
  76. scanf("%hu", &US);
  77. char c[3];
  78. scanf("%s",c);
  79.  
  80. /*printf("UI = %u\n",UI);
  81.   printf("US = %hu\n",US);
  82.   printf("c[0] = %d\n",c[0]);
  83.   printf("c[1] = %d\n",c[1]);*/
  84.  
  85. ULLI = type0(str,UI,US,c);
  86.  
  87. printf("%llu",ULLI);
  88.  
  89. printf("\n");
  90. for (int i = 0;i < 64;i ++)
  91. {
  92. int bit;
  93. bit = ULLI & 1;
  94. printf("%d",bit);
  95. ULLI >>= 1;
  96. }
  97. }
  98. return 0;
  99. }
  100.  
Compilation error #stdin compilation error #stdout 0s 4572KB
stdin
0
LSCC 3608568949 21353 Fp
compilation info
prog.c: In function ‘type0’:
prog.c:14:32: warning: variable ‘c1_shift’ set but not used [-Wunused-but-set-variable]
         unsigned long long int c1_shift;
                                ^~~~~~~~
prog.c:13:32: warning: variable ‘c0_shift’ set but not used [-Wunused-but-set-variable]
         unsigned long long int c0_shift;
                                ^~~~~~~~
prog.c:12:32: warning: variable ‘US_shift’ set but not used [-Wunused-but-set-variable]
         unsigned long long int US_shift;
                                ^~~~~~~~
prog.c:11:32: warning: variable ‘UI_shift’ set but not used [-Wunused-but-set-variable]
         unsigned long long int UI_shift;
                                ^~~~~~~~
prog.c:57:11: error: ‘UI_shift’ undeclared (first use in this function)
  answer = UI_shift + UI_shift + c0_shift + c1_shift;
           ^~~~~~~~
prog.c:57:11: note: each undeclared identifier is reported only once for each function it appears in
prog.c:57:33: error: ‘c0_shift’ undeclared (first use in this function)
  answer = UI_shift + UI_shift + c0_shift + c1_shift;
                                 ^~~~~~~~
prog.c:57:44: error: ‘c1_shift’ undeclared (first use in this function)
  answer = UI_shift + UI_shift + c0_shift + c1_shift;
                                            ^~~~~~~~
prog.c: In function ‘main’:
prog.c:64:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&task_type);
     ^~~~~~~~~~~~~~~~~~~~~~
prog.c:69:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",str);
         ^~~~~~~~~~~~~~~
prog.c:74:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%u", &UI);
         ^~~~~~~~~~~~~~~~
prog.c:76:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%hu", &US);
         ^~~~~~~~~~~~~~~~~
prog.c:78:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",c);
         ^~~~~~~~~~~~~
stdout
Standard output is empty