문제

when we put put delay, it will put a delay between doing the up line and down line or it will put a delay in doing all of the lines in our code?

int main()
{
  if ( kbhit() )
  {
   E = getCommand();
   doCommand(E);
   delay(100);
  }
}
도움이 되었습니까?

해결책

There is no standard delay function, but many non-standard headers (like dos.h) and custom implementations are available in which it is used to suspend execution of a program for a particular time.

So, after executing doCommand(E), your program will wait for 100 milliseconds, i.e. it will pause for that time period, before executing further.

다른 팁

There is no standard function called delay() in C. But it will very probably just insert a pause at the place where the function is called, that's a very common design.

Since the shown code doesn't loop or anything, it will just pause, then exit.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top