虽然我一直坐在这个话题了几个月,我是比较新的C.我试图写一个简单的问题/回应计划。我知道它与其他条件(其他所有条件)都有关系,但是我已经搜索并且似乎无法找到问题。最后还有递归重复该程序的递归。我放入它的函数调用可能是错误的。
#include <stdio.h>
main()
{
char line[100];
char decision[100];
printf("Are you gonna throw it?\n");
printf("Type yes or no.\n");
scanf("%s", line);
printf("%s \n", line);
if (line == "yes") {
printf("Thanks.\n");
} else if (line == "no") {
printf("Why not?\n");
}
printf("Do you want to do this again?\n");
scanf("%s", decision);
if (decision == "yes") {
main();
};
}
对不起。比较字符串的想法并没有到我这里来。 – kizlink