当按下~代字号键时,break关键字与if命令一起使用以退出循环:

#include <stdio.h>
int main()
{
   char ch;
   puts(Start typing);
   puts(Press ~ then Enter to stop);
   for(;;)
   {
      ch=getchar();
      if(ch=='~')
      {
         break;
      }
   }
   printf(Thanks!\n);
   return(0);
}

相关文章

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