Problem | diamond |
---|---|
User | god |
Submission Time | 2025-07-10 09:14:31 |
Score | 0 |
Max Time | N/A |
Max Memory | N/A |
Owl Get a Life
diamond.cpp: In function ‘int main()’:
diamond.cpp:8:40: error: invalid operands of types ‘const char*’ and ‘const char [2]’ to binary ‘operator+’
8 | string cut = "% " + char(max_length) + "%";
| ~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
| | |
| const char* const char [2]
diamond.cpp:9:30: error: invalid operands of types ‘const char [2]’ and ‘int’ to binary ‘operator*’
9 | string to_be_printed = "*" * length;
| ~~~ ^ ~~~~~~
| | |
| | int
| const char [2]
diamond.cpp:10:10: error: cannot convert ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to ‘const char*’
10 | printf(cut, to_be_printed);
| ^~~
| |
| std::string {aka std::__cxx11::basic_string&