雖然我一直坐在這個話題了幾個月,我是比較新的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