对于你们来说,这可能是一个简单的解决方案,但对我来说确实如此,这段代码并没有满足我的要求。输入P x y,如果按Q或q则退出,否则显示坐标,但不起作用,建议大家!
#include <stdio.h>
int main()
{
float x, y;
char input;
scanf("c", &input);
if (input == 'Q' || input == 'q')
{
printf("terminating program");
return(0);
}
else
{
scanf(" %c %f%f", &input, &x, &y);
printf("coordinates for %c are %f %f", input, x, y);
}
return(0);
}