How can I complete an endless loop in Turbo C?

I'm stuck in an endless loop. How can I complete this cycle? I tried to use / click Cntrl c, but nothing happens. I do not know how to stop him.

main()
{
     while (1)
     {
          char ch;
          printf("Enter a character: \n");
          ch = getche();
          printf("\nThe code for %c is %d.\n", ch, ch);
     }
}
+3
source share
5 answers

CTRL BREAKwill probably work for this. I have a vague memory of CTRL Cnot always working with Borland products.

Although, it was a long time ago, so I had to extract from a very deep memory, which may disappear somewhat :-)


My question is for you: why is someone still using Turbo C when much better and equally cheap solutions are available? Like gcc (e.g. in Code :: Blocks) or even Microsoft Visual C Express.

+6
source

, while.

,

main()
{
   char ch = ' ';
   while (ch != 'q')
   {

      printf("Enter a character: \n");
      ch = getche();
      printf("\nThe code for %c is %d.\n", ch, ch);
   }
}

, char "q", (1), "break":

main()
{

   while (1)
   {
      char ch;
      printf("Enter a character: \n");
      ch = getche();
      printf("\nThe code for %c is %d.\n", ch, ch);

      if (ch == 'q')
         break;       

   }
}
+1

CTRL-Break, Break CTRL-C , CTRL-ESC-ESC ! ( Borland ++ 3.1).

+1

Turbo C, BREAK. Turbo C, CTRL + BREAK. .

, , !

-1

. , , , exit() , .

-2

All Articles