使用字符作为菜单选项

#include <stdio.h>  
int main()
{ 
   char cResponse = '\0'; 

   printf(\na\tTurn the AC on\n); 
   printf(b\tTurn the AC off\n); 
   printf(\nEnter your selection: ); 
   scanf(%c, &cResponse); 

   if (cResponse == 'a'){ 
      printf(\nAC is Now on\n); 
   }
   if (cResponse == 'b') {
      printf(\nAC is Now off\n); 
   }
}

相关文章

for遍历数组
。。。
声明一个计数循环
咕咕咕
#include <stdio.h> int main (void) { printf (&quo...