【发布时间】:2015-08-10 11:54:46
【问题描述】:
我有以下代码块。最后一行用于生成用户输入的X、Y 和P 值。但是它只返回
(0,0,0)
而不是用户给出的值。我错过了什么?
printf("What is the robot's initial X position? (cm)\n");
scanf("%f",&X);
printf("What is the robot's initial Y position? (cm)\n");
scanf("%f",&Y);
printf("What is the robot's initial angular position? (degrees)\n");
scanf("%f",&P);
printf("The initial position is (%d, %d, %d)\n", X,Y,P);
【问题讨论】:
-
究竟是什么
PrintF??? -
@SouravGhosh 刚刚编辑了我的标题,意思是“printf”
-
您将 X、Y 和 P 扫描为
doubles,但将它们打印为ints,它们的类型是什么?
标签: c printf scanf format-specifiers