【发布时间】:2014-09-20 05:03:35
【问题描述】:
我对编程非常陌生,目前正在开发一个程序(还远未完成),但我无法弄清楚这不起作用以及为什么不起作用。我一定错过了“if”和“else”的一些东西
#include <stdio.h>
int main(void)
{
printf("Welcome to the ROBOT GAME!\n"
"Please enter the column of your starting point. Keep numbers in the range of one to three.\n");
int a, b;
if(1<=a<=3);
{
scanf("%i", &a);
}
else
{
printf("Sorry try again.");
}
printf("Please enter the row of your starting point. Keep numbers in the range of one to three.\n");
if(1>=b<=3);
scanf("%i", &b);
printf("What is your next move? Pick\n"
"1.Right\n"
"2.Left\n"
"3.Up\n"
"4.Down\n");
}
【问题讨论】:
-
请阅读基本的 C 教程。
-
C Program Problems with Loops循环在哪里? Need to learn basic aboutC -
在
if(<=2=3)之后删除; -
如果您要将代码发布到无法编译的 SO,您至少必须包含您收到的错误消息。 “行不通”是不够的。
标签: c