记录详情

Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:11:2: error: 'V' was not declared in this scope
  V = 3.14*pow(d/2.2)*h;
  ^
/in/foo.cc:11:20: error: no matching function for call to 'pow(double)'
  V = 3.14*pow(d/2.2)*h;
                    ^
In file included from /usr/include/features.h:364:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/c++config.h:507,
                 from /usr/include/c++/6/iostream:38,
                 from /in/foo.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:153:1: note: candidate: double pow(double, double)
 __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
 ^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:153:1: note:   candidate expects 2 arguments, 1 provided
In file included from /in/foo.cc:3:0:
/usr/include/c++/6/cmath:438:5: note: candidate: template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)
     pow(_Tp __x, _Up __y)
     ^~~
/usr/include/c++/6/cmath:438:5: note:   template argument deduction/substitution failed:
/in/foo.cc:11:20: note:   candidate expects 2 arguments, 1 provided
  V = 3.14*pow(d/2.2)*h;
                    ^
In file included from /in/foo.cc:3:0:
/usr/include/c++/6/cmath:415:3: note: candidate: constexpr long double std::pow(long double, long double)
   pow(long double __x, long double __y)
   ^~~
/usr/include/c++/6/cmath:415:3: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/6/cmath:411:3: note: candidate: constexpr float std::pow(float, float)
   pow(float __x, float __y)
   ^~~
/usr/include/c++/6/cmath:411:3: note:   candidate expects 2 arguments, 1 provided
/in/foo.cc:12:17: warning: format '%f' expects a matching 'double' argument [-Wformat=]
  printf("%.2f,v");
                 ^
/in/foo.cc:9:15: warning: unused variable 'v' [-Wunused-variable]
     float d,h,v;
               ^

信息

递交者
类型
递交
题目
p1012 求圆柱的体积
语言
C++
递交时间
2021-11-19 19:00:52
评测时间
2021-11-19 19:01:14
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes