0208, skip(), pause()
(高顯忠, sjgau4311@gmail.com, 2011-02-08 11:24)
1樓
// skip(-3);
void skip(int no)
{
// limits no in 1 .. 20
if ((no >= 1) && (no <= 20)) {// no is OK
int i;
for (i=1;i<=no;i++) {
printf("\n");
}
}
else {// no is invalid!
printf("\n");
}
}// end of skip()
// ----------------------------------------------
// pause();
void pause(void)
{
// remove type- ahead
while (kbhit()) {
getch();
}
// ----------------------------------------------
printf(" *** Press [Esc] key for Stop! or other key for Continue...");
do {
// wait for KeyPress
} while(!_kbhit());
int ch1= getch();
printf("\n");
// ----------------------------------------------
if (ch1==0x1b) {// [Esc] key be pressed
exit(1);
}
// remove extra key Strok
while (kbhit()) {
getch();
}
}// end of pause()
// ----------------------------------------------