ID 5421978
Пользователь Пиляй Николай Владимирович
Время 16:07<< 30.09.2021 16:09 (15 д. 06:43) 20:31>>
Обработка 16:09 ... 16:09 (3,19 сек.)
Файл 5421978.cpp (CLang++ 5.0.0 + Address Sanitizer)
Турнир 2 курс. Программирование на C++. Турнир 1, осень 2021
Задача E: Date
Набор тестов
Ограничения Время: 1с Память: 512Мб
Состояние  [?]
CE Ошибка компиляции
код | результаты
In file included from main.cpp:16:0:
date.h: In member function 'std::__cxx11::string Date::ToString() const':
date.h:26:61: error: cannot convert 'std::__cxx11::basic_string<char>' to 'const char*' in initialization
 const char* str_d = std::to_string(this->d + 100).erase(0, 1);
                                                             ^
date.h:27:61: error: cannot convert 'std::__cxx11::basic_string<char>' to 'const char*' in initialization
 const char* str_m = std::to_string(this->m + 100).erase(0, 1);
                                                             ^
date.h:28:63: error: cannot convert 'std::__cxx11::basic_string<char>' to 'const char*' in initialization
 const char* str_y = std::to_string(this->y + 10000).erase(0, 1);
                                                               ^
date.h:29:30: error: invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
 const char* str_date = str_d + "." + str_m + "." + str_y;
                        ~~~~~~^~~~~
date.h: In member function 'Date Date::DaysLater(int) const':
date.h:37:1: error: 'int64' was not declared in this scope
 int64 days_count = 365 * new_y + new_y / 4 - new_y / 100 + new_y / 400 +
 ^~~~~
date.h:37:1: note: suggested alternative: 'rintf64'
 int64 days_count = 365 * new_y + new_y / 4 - new_y / 100 + new_y / 400 +
 ^~~~~
 rintf64
date.h:39:1: error: 'days_count' was not declared in this scope
 days_count += days;
 ^~~~~~~~~~
date.h:34:5: error: unused variable 'new_d' [-Werror=unused-variable]
 int new_d = this->d;
     ^~~~~
date.h: In member function 'int Date::DaysLeft(const Date&) const':
date.h:56:37: error: too few arguments to function 'tm* localtime_r(const time_t*, tm*)'
 struct std::tm a = *localtime_r(&tmp);;
                                     ^
In file included from /usr/include/pthread.h:24:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/gthr.h:148,
                 from /usr/include/c++/7/ext/atomicity.h:35,
                 from /usr/include/c++/7/bits/ios_base.h:39,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from main.cpp:1:
/usr/include/time.h:133:19: note: declared here
 extern struct tm *localtime_r (const time_t *__restrict __timer,
                   ^~~~~~~~~~~
In file included from main.cpp:16:0:
date.h:57:37: error: too few arguments to function 'tm* localtime_r(const time_t*, tm*)'
 struct std::tm b = *localtime_r(&tmp);;
                                     ^
In file included from /usr/include/pthread.h:24:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/gthr.h:148,
                 from /usr/include/c++/7/ext/atomicity.h:35,
                 from /usr/include/c++/7/bits/ios_base.h:39,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from main.cpp:1:
/usr/include/time.h:133:19: note: declared here
 extern struct tm *localtime_r (const time_t *__restrict __timer,
                   ^~~~~~~~~~~
cc1plus: all warnings being treated as errors
[печатать | |
]
(1 827 b)
0.037s 0.009s 10