记录详情

Compile Error

/in/foo.cc: In constructor 'BigInt::BigInt(const string&)':
/in/foo.cc:42:39: error: passing 'const string {aka const std::__cxx11::basic_string<char>}' as 'this' argument discards qualifiers [-fpermissive]
     if (isNegative) str = str.substr(1);
                                       ^
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:633:7: note:   in call to 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
       operator=(basic_string&& __str)
       ^~~~~~~~
/in/foo.cc: In member function 'BigInt BigInt::multiplyBySingleDigit(int) const':
/in/foo.cc:52:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < digits.size() || carry > 0; ++i) {
                     ~~^~~~~~~~~~~~~~~
/in/foo.cc:53:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (i < digits.size()) {
             ~~^~~~~~~~~~~~~~~
/in/foo.cc: In member function 'BigInt BigInt::add(const BigInt&) const':
/in/foo.cc:81:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (i < digits.size()) sum += digits[i];
             ~~^~~~~~~~~~~~~~~
/in/foo.cc:82:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (i < other.digits.size()) sum += other.digits[i];
             ~~^~~~~~~~~~~~~~~~~~~~~
/in/foo.cc: In member function 'BigInt BigInt::subtract(const BigInt&) const':
/in/foo.cc:96:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (i < other.digits.size()) diff -= other.digits[i];
             ~~^~~~~~~~~~~~~~~~~~~~~
/in/foo.cc: In member function 'BigInt BigInt::operator*(const BigInt&) const':
/in/foo.cc:117:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < other.digits.size(); ++i) {
                     ~~^~~~~~~~~~~~~~~~~~~~~

信息

递交者
类型
自测
题目
P1023 OO6-1 高精度整数类的乘法运算
语言
C++
递交时间
2024-05-01 12:42:42
评测时间
2024-05-01 12:42:42
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes