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:

import std.stdio;
import std.conv;

int main(){
    string[2] n = readln().split();
    writeln(to!int(n[0]) + to!int(n[1]));
}

By importing std.conv, the to!int function becomes available, allowing you to convert the string elements to integers before performing the addition

import stdstdio;import stdarray;int main string2 n=readlnsplit; writelnto!intn0+to!intn1;报错信息:maind5 Error template instance to!int template to is not definedmaind5 Error template instance to!in

原文地址: https://www.cveoy.top/t/topic/ierw 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录