我有一个小 C 程序的问题。它输出一个问题(见下面的代码),我可以将其输入(y 和 n),但随后什么也没有发生,即使它是为了根据输入的输入(y 或 n)打印一些东西。但是,在我的问题之后没有输出任何内容,程序就退出了。这是代码:
#include <stdio.h>
int main()
{
char string [80];
static char y;
static char n;
printf( "ARE YOU SHAQIRI? [y/n]: " );
scanf( "%s", string );
if ("%s" == "y")
printf("That's impossible. YOU CANNOT BE SHAQIRI YOU IDIOT");
else if ("%s" == "n")
printf("I thought not.");
fflush ( stdin );
return 0;
}