求助 本地正确 上传全错

P1957 口算练习题

if(str[0]>='0'&&str[0]<='9')试一试 ```c if(str[0]>='a') { leixing=str[0]; for(x=2;str[x]!=' ';x++) { a1=str[x]-'0'; a=a*10+a1; changdu++; } for(x=x+1;str[x]!='\0';x++) { b1=str[x]-'0'; b=b*10+b1;changdu++; } } ```
by telankesi @ 2022-12-28 08:43:43


@[telankesi](/user/866969) 但是这好像没用啊
by wayc04 @ 2022-12-28 10:45:33


应该是 scanf(" %[^\n]",str); 的问题,用洛谷在线IDE,这样是输入不了的
by AlexFad @ 2023-04-28 20:55:02


改成这样就行了 ```cpp scanf("%*[\r\n]%[^\n]",s); ```
by AlexFad @ 2023-04-28 21:01:03


|