Mã chấm Tài khoản Bài tập Ngôn ngữ lập trình Trạng thái Thời gian Bộ nhớ Kích thước Thời gian nộp
257080 Nguyễn Viết Hiến Biến đổi nhị phân C/C++ Lỗi biên dịch (CE) 0 MS 0 KB 1104 2023-10-29 20:55:14

Lỗi biên dịch:

Main.cc: In function ‘int dem00(char*, int)’:
Main.cc:10:26: error: ‘MAX’ was not declared in this scope
         char newSequence[MAX];
                          ^~~
Main.cc:13:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int j = 0; j < strlen(sequence); j++) {
                         ~~^~~~~~~~~~~~~~~~~~
Main.cc:15:17: error: ‘newSequence’ was not declared in this scope
                 newSequence[newLen++] = '0';
                 ^~~~~~~~~~~
Main.cc:15:17: note: suggested alternative: ‘sequence’
                 newSequence[newLen++] = '0';
                 ^~~~~~~~~~~
                 sequence
Main.cc:18:17: error: ‘newSequence’ was not declared in this scope
                 newSequence[newLen++] = '1';
                 ^~~~~~~~~~~
Main.cc:18:17: note: suggested alternative: ‘sequence’
                 newSequence[newLen++] = '1';
                 ^~~~~~~~~~~
                 sequence
Main.cc:22:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (j < strlen(sequence) - 1 && sequence[j] == '0' && sequence[j + 1] == '0') {
                 ~~^~~~~~~~~~~~~~~~~~~~~~
Main.cc:27:9: error: ‘newSequence’ was not declared in this scope
         newSequence[newLen] = '\0';
         ^~~~~~~~~~~
Main.cc:27:9: note: suggested alternative: ‘sequence’
         newSequence[newLen] = '\0';
         ^~~~~~~~~~~
         sequence
Main.cc: In function ‘int main()’:
Main.cc:36:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &a);
     ~~~~~^~~~~~~~~~
Main.cc:40:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &n);
         ~~~~~^~~~~~~~~~