skip(), pause()
(高顯忠, sjgau4311@gmail.com, 2011-01-22 11:58)
1樓
// skip( 3);
void skip(int no)
{
int i;
// limits no in 1 .. 20
if ((no >= 1) && (no <= 20)) {// OK, no is OK
for (i=1;i<=no;i++) {
// printf("i= %2d \n", i);
printf("\n");
}
}
else {// no Good!
// printf("\n no Good! \n");
printf("\n");
}
}// end of skip()
// --------------------------------------------------------
// pause();
void pause(void)
{
// remove type- ahead
while (kbhit()) {
getch();
}
printf("Press [Esc] for stop! others for Continue...");
do {
// wait for keyPressed
} while (!kbhit());
printf("\n");
int ch1= getch();
if (ch1==0x1b) {
exit(1);
}
// remove extra keyStroke
while (kbhit()) {
getch();
}
}// end of pause()
// --------------------------------------------------------