C/Console/Console Read Any

Материал из C\C++ эксперт
Перейти к: навигация, поиск

Press any key to exit: kbhit()

<source lang="cpp">

  1. include <stdio.h>
  2. include <conio.h>

int main(void) {

 double amount;
 amount = 0.20;
 cprintf("Printing 5-percent tax table\n\r");
 cprintf("Press a key to stop.\n\n\r");

 do {
   cprintf("amount: %f, tax: %f\n\r", amount, amount * 0.05);

   if(kbhit()) 
       break;

   amount = amount + 0.20;

 } while(amount < 100.0);
 return 0;

}


      </source>