D编程语言错误:模板实例`to!int`未定义 - 解决方法
The error message is indicating that the to template is not defined. The to template is part of the std.conv module in the D programming language. To fix the error, you need to import the std.conv module and use the to function from that module to convert the string elements to integers. Here's the corrected code:\n\nd\nimport std.stdio;\nimport std.conv;\n\nint main(){\n    string[2] n = readln().split();\n    writeln(to!int(n[0]) + to!int(n[1]));\n}\n\n\nBy importing std.conv, the to!int function becomes available, allowing you to convert the string elements to integers before performing the addition.
原文地址: https://www.cveoy.top/t/topic/pW05 著作权归作者所有。请勿转载和采集!