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
268490 Mai Thị Minh Số PI C/C++ Lỗi biên dịch (CE) 0 MS 0 KB 335 2023-11-18 20:16:49

Lỗi biên dịch:

Main.cc: In function ‘int main()’:
Main.cc:6:18: error: invalid operands of types ‘const char [4]’ and ‘double’ to binary ‘operator&’
     scanft("%lf" &c);
            ~~~~~~^~
Main.cc:6:5: error: ‘scanft’ was not declared in this scope
     scanft("%lf" &c);
     ^~~~~~
Main.cc:6:5: note: suggested alternative: ‘scanf’
     scanft("%lf" &c);
     ^~~~~~
     scanf
Main.cc:10:15: error: ‘n’ was not declared in this scope
     while (0<=n<=5000) {
               ^
Main.cc:11:57: error: expected ‘;’ before ‘+’ token
         res+= 1 - (1/3) + (1/5) -(1/7) + (1/9) - (1/11) +... ;
                                                         ^
Main.cc:14:5: error: expected ‘,’ or ‘;’ before ‘printf’
     printf("PI = %0.8lf", PI);
     ^~~~~~
Main.cc:7:9: warning: unused variable ‘k’ [-Wunused-variable]
     int k=0;
         ^
Main.cc:9:9: warning: unused variable ‘signal’ [-Wunused-variable]
     int signal=-1;
         ^~~~~~
Main.cc:13:12: warning: unused variable ‘PI’ [-Wunused-variable]
     double PI = 4 * res
            ^~