Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:7:32: error: 'setprecision' was not declared in this scope
     cout<<fixed<<setprecision(2)<<abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2;
                                ^
/in/foo.cc:7:71: error: call of overloaded 'abs(double)' is ambiguous
     cout<<fixed<<setprecision(2)<<abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2;
                                                                       ^
In file included from /usr/include/c++/6/cstdlib:75:0,
                 from /usr/include/c++/6/ext/string_conversions.h:41,
                 from /usr/include/c++/6/bits/basic_string.h:5417,
                 from /usr/include/c++/6/string:52,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:1:
/usr/include/stdlib.h:735:12: note: candidate: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^~~
In file included from /usr/include/c++/6/ext/string_conversions.h:41:0,
                 from /usr/include/c++/6/bits/basic_string.h:5417,
                 from /usr/include/c++/6/string:52,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^~~
/usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^~~

信息

递交者
类型
递交
题目
P2326 1.3.17:计算三角形面积
语言
C++
递交时间
2024-10-27 10:37:13
评测时间
2024-10-27 10:37:13
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes