Compile Error

foo.cc:7:16: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    7 |         printf('%.2lf',fabs(a));
      |                ^~~~~~~
foo.cc: In function ‘int main()’:
foo.cc:7:16: error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive]
    7 |         printf('%.2lf',fabs(a));
      |                ^~~~~~~
      |                |
      |                int
In file included from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/cstdio:42,
                 from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/ext/string_conversions.h:45,
                 from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/basic_string.h:4154,
                 from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/string:54,
                 from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bitset:52,
                 from stdc++.h:52:
/nix/glibc-2.40-66-dev/include/stdio.h:363:43: note:   initializing argument 1 of ‘int printf(const char*, ...)’
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
foo.cc:8:17: error: expected ‘;’ before ‘}’ token
    8 |         return 0
      |                 ^
      |                 ;
    9 | }
      | ~                

信息

递交者
类型
自测
题目
P2331 1.4.2:输出绝对值
语言
C++
递交时间
2025-07-19 12:28:45
评测时间
2025-07-19 12:28:45
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes