scanf("%2d%*2d%1d",&x,&y);是什么意思%2d%*2d%1d输入1234567main(){int x,y;scanf("%2d%*2d%1d",&x,&y);printf("%d\n",x+y);getch();}

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 12:03:09
scanf("%2d%*2d%1d",&x,&y);是什么意思%2d%*2d%1d输入1234567main(){intx,y;scanf("%2d%*2d%1d",&x,&y);printf("%d

scanf("%2d%*2d%1d",&x,&y);是什么意思%2d%*2d%1d输入1234567main(){int x,y;scanf("%2d%*2d%1d",&x,&y);printf("%d\n",x+y);getch();}
scanf("%2d%*2d%1d",&x,&y);是什么意思%2d%*2d%1d
输入1234567
main()
{
int x,y;
scanf("%2d%*2d%1d",&x,&y);
printf("%d\n",x+y);
getch();
}

scanf("%2d%*2d%1d",&x,&y);是什么意思%2d%*2d%1d输入1234567main(){int x,y;scanf("%2d%*2d%1d",&x,&y);printf("%d\n",x+y);getch();}
这题我貌似再哪本书上看到过= =||
%2d 是输入两列数,例如 123456 只会输入前面的两列数,12 后面的数都被舍去了
%*2d 是跳过这个输入,也就是说,虽然那里有三个%d 但实际上只读入了两个数而已
如键盘输入 12345 6587 实际上读入的数只是 12 6 这两个.