帮忙写下注释
是x进制的数n转换为十进制的数的代码中有这么一段:while((s[i]=getchar())!='\n'){
ans=ans*n+(s[i]-48);
i++;
}
大佬们帮忙写下意思和注释
2022-06-18 19:25
程序代码:
while((s[i]=getchar())!='\n'){ //输入字符直到回车结束
ans=ans*n+(s[i]-48); //s[i]转换为数字,s[i]-48是s[i]-'0'
i++;
}
2022-06-19 12:14