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/11/24 15:34:24
scanf(
x͑]KA (jKn,E E)- Դ 5?3dAW2s{]1 mzmNoͰ>`ɥ;xCYIdSA_K$}g=_2b~)"B] [tBd J;[]ɕ7/8™6 _rXNV_CB<ztVQeE>LH&OJ-M<8ײD١q6! 9B9 5K!RlIkQ^7ԧjCpVqO<)(c9'J

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 这两个.