记录详情

Compile Error

/in/foo.cc: In function 'int digit(int, int)':
/in/foo.cc:7:23: error: 'to_string' was not declared in this scope
  int len=to_string(num).length();//取数值位数
                       ^
/in/foo.cc:7:23: note: suggested alternatives:
In file included from /usr/include/c++/6/string:52:0,
                 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/bits/basic_string.h:5522:3: note:   'std::__cxx11::to_string'
   to_string(long double __val)
   ^~~~~~~~~
/usr/include/c++/6/bits/basic_string.h:5522:3: note:   'std::__cxx11::to_string'
/in/foo.cc: In function 'int main()':
/in/foo.cc:27:2: error: 'cin' was not declared in this scope
  cin>>num;
  ^~~
/in/foo.cc:27:2: note: suggested alternative:
In file included from /in/foo.cc:1:0:
/usr/include/c++/6/iostream:60:18: note:   'std::cin'
   extern istream cin;  /// Linked to standard input
                  ^~~
/in/foo.cc:28:23: error: 'to_string' was not declared in this scope
  int len=to_string(num).size();
                       ^
/in/foo.cc:28:23: note: suggested alternatives:
In file included from /usr/include/c++/6/string:52:0,
                 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/bits/basic_string.h:5522:3: note:   'std::__cxx11::to_string'
   to_string(long double __val)
   ^~~~~~~~~
/usr/include/c++/6/bits/basic_string.h:5522:3: note:   'std::__cxx11::to_string'
/in/foo.cc:36:2: error: 'cout' was not declared in this scope
  cout<<S<<endl;
  ^~~~
/in/foo.cc:36:2: note: suggested alternative:
In file included from /in/foo.cc:1:0:
/usr/include/c++/6/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^~~~
/in/foo.cc:36:11: error: 'endl' was not declared in this scope
  cout<<S<<endl;
           ^~~~
/in/foo.cc:36:11: note: suggested alternative:
In file included from /usr/include/c++/6/iostream:39:0,
                 from /in/foo.cc:1:
/usr/include/c++/6/ostream:590:5: note:   'std::endl'
     endl(basic_ostream<_CharT, _Traits>& __os)
     ^~~~

信息

递交者
类型
递交
题目
判断1的个数
语言
C++
递交时间
2024-05-22 16:16:32
评测时间
2024-05-22 16:16:32
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes