Problem diamond
User god
Submission Time 2025-07-10 09:14:01
Score 0
Max Time N/A
Max Memory N/A

Compile Error

diamond.cpp: In function ‘int main()’:
diamond.cpp:8:34: error: invalid operands of types ‘const char*’ and ‘const char [2]’ to binary ‘operator+’
8 | string cut = "% " + 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<char>}
In file