我要檢查,如果用戶輸入等於某個值檢查是否變量是一定值
#include <stdio.h>
#include <windows.h>
int main()
{
SetConsoleOutputCP(1252);
SetConsoleCP(1252);
char meningen[100];
printf("Hello \n");
printf("I want you to write 'Simon Anderson'.\n");
scanf(" %[^\n]s", meningen);
if (meningen == "Simon Anderson")
{
printf("Congratilation. You have won the game.\n");
printf("Have a good day");
}
else {
printf("You failed.\n");
}
getchar();
getchar();
return 0;
}
的問題是什麼我寫我還得到了「你沒有」打印出來。我如何做到這一點,如果用戶在if語句中寫入值,它會返回true。
謝謝