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
268485 Văn Hà Minh Quân Số PI C/C++ Lỗi biên dịch (CE) 0 MS 0 KB 263 2023-11-18 20:16:13

Lỗi biên dịch:

Main.cc: In function ‘double pi(int)’:
Main.cc:7:6: error: invalid operands of types ‘double(int)’ and ‘__gnu_cxx::__promote_2::__type {aka double}’ to binary ‘operator+’
   pi += pow(-1,i)/(2*i+1);
   ~~~^~~~~~~~~~~~~~~~~~~~
Main.cc:7:25: error:   in evaluation of ‘operator+=(double(int), __gnu_cxx::__promote_2::__type {aka double})’
   pi += pow(-1,i)/(2*i+1);
                         ^
Main.cc: In function ‘int main()’:
Main.cc:15:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%ld", &n);
   ~~~~~^~~~~~~~~~~