各位大佬,我初学c语言,遇上了点问题。
#include<stdio.h>
int main()
{
int a,b,s;
scanf("s=%d+%d",&a,&b);
printf("%d\n",s);
return 0;
}
这个程序能运行,但不管输入什么数,这个输出结果一直是1
各位大佬,我初学c语言,遇上了点问题。
#include<stdio.h>
int main()
{
int a,b,s;
scanf("s=%d+%d",&a,&b);
printf("%d\n",s);
return 0;
}
这个程序能运行,但不管输入什么数,这个输出结果一直是1
scanf中不要写多余的字符,直接scanf("%d%d",&a,&b);就行了