이 루프는 매트릭스 영화 (LOL)처럼 화면에서 1과 0을 생성하지만 코드가 실제로 빠르게 실행되는 방식으로 숫자가 천천히 나타납니다.for 루프의 속도를 늦추십시오.
5
A
답변
7
사용 Sleep(3000);
예를
#include <iostream>
#include <stdlib.h>
#include <Windows.h>
using namespace std;
int main(int argc,char**argv){
cout<<"a"<<endl;
Sleep(3000);
cout<<"b"<<endl;
return 0;
}
3
체크 아웃 usleep
당신도 잠을 잘 수 있지만 너무 느릴 것이라고 생각합니다. 당신은 당신이 당신이 임의의 무의미 CIN에 넣을 수 준비가 될 때까지 중지 할 경우
USLEEP(3) BSD Library Functions Manual USLEEP(3)
NAME
usleep -- suspend thread execution for an interval measured in microseconds
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <unistd.h>
int
usleep(useconds_t useconds);
DESCRIPTION
The usleep() function suspends execution of the calling thread until either useconds microseconds have elapsed or a signal is delivered to the thread whose action
is to invoke a signal-catching function or to terminate the thread or process. The actual time slept may be longer, due to system latencies and possible limita-
tions in the timer resolution of the hardware.
This function is implemented, using nanosleep(2), by pausing for useconds microseconds or until a signal occurs. Consequently, in this implementation, sleeping
has no effect on the state of process timers and there is no special handling for SIGALRM.
RETURN VALUES
The usleep() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error.
ERRORS
The usleep() function will fail if:
[EINTR] A signal was delivered to the process and its action was to invoke a signal-catching function.
SEE ALSO
nanosleep(2), sleep(3)
HISTORY
The usleep() function appeared in 4.3BSD.
BSD February 13, 1998 BSD
+0
또는 Windows에서'절전 '. –
1
3000 밀리 초 을 기다리는. 리턴을 누를 때까지 입력을 기다릴 것입니다.
관련 문제
- 1. 루핑 애니메이션 속도를 늦추십시오.
- 2. MovieClip의 재생 속도를 늦추십시오.
- 3. 피들러가 내 브라우저 속도를 늦추십시오.
- 4. dispatch_async가 UI 및 앱 속도를 늦추십시오.
- 5. OSX/Linux, 터미널에서 출력 속도를 늦추십시오.
- 6. 정렬을 통해 파이썬에서 "for"루프의 속도를 높일 수 있습니까?
- 7. for 루프의 함수 호출
- 8. for 루프의 성능 문제?
- 9. for 루프의 NSTimer
- 10. for 루프의 @ SCP
- 11. for 루프의 끝에서의 지연
- 12. for 루프의 조건 C++
- 13. For 루프의 범위 설정
- 14. for 루프의 벡터화 R
- 15. for 루프의 할당 타이밍
- 16. for 루프의 스칼라 println
- 17. for 루프의 구문 설명?
- 18. for 루프의 무작위 반복
- 19. for 루프의 헤더 호출
- 20. for 루프의 의미는 무엇입니까?
- 21. Javascript "for"루프의 범위
- 22. for 루프의 문이
- 23. for 루프의 포인터 연산
- 24. for 루프의 배열, C99
- 25. for 루프의 실행 시간
- 26. R for for 루프의 열 이름 처리
- 27. 파이썬 중첩 루프의 속도를 높이려면 어떻게해야합니까?
- 28. For 루프의 부울 논리의 목적
- 29. for 루프의 헤더에는 무엇이 허용됩니까?
- 30. Objective-C - For 루프의 addSubview?
나머지 외부 루프가 실행되지 않는다는 것을 알고 계십니까? –
그래,하지만 난 iterators 그 전에 그것을 제거, 외부 루프를 제외하는 것을 잊었 – Kamran