知識社群登入
位置: AutoCAD開放式教學 > 討論區 > 討論
skip(), pause()
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()
// --------------------------------------------------------