Mã chấm Tài khoản Bài tập Ngôn ngữ lập trình Trạng thái Thời gian Bộ nhớ Kích thước Thời gian nộp
268267 Phạm Huỳnh Hưng Số PI C/C++ Lỗi biên dịch (CE) 0 MS 0 KB 966 2023-11-18 20:02:00

Lỗi biên dịch:

Main.cc: In function ‘int calculateMaxValue(const string&)’:
Main.cc:7:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 1; i < str.length(); i++) {
                     ~~^~~~~~~~~~~~~~
Main.cc:10:26: error: assignment of read-only location ‘(& str)->std::__cxx11::basic_string::operator[](((std::__cxx11::basic_string::size_type)i))’
                 str[i] = 'b';
                          ^~~
Main.cc:12:26: error: assignment of read-only location ‘(& str)->std::__cxx11::basic_string::operator[](((std::__cxx11::basic_string::size_type)i))’
                 str[i] = 'a';
                          ^~~
Main.cc:14:26: error: assignment of read-only location ‘(& str)->std::__cxx11::basic_string::operator[](((std::__cxx11::basic_string::size_type)i))’
                 str[i] = 'a';
                          ^~~