Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- tips강좌
- mysql
- 유료강좌
- 별찍기
- 정처기 독학
- 도움말
- mfc 실습
- C
- Tipsware
- Time
- 실습
- visual
- MFC
- win32
- MyThread
- linux
- ListBox
- 김성엽
- 포트폴리오
- 핵심 요약
- MFC 예제
- 정보처리기사
- C++
- 충무창업큐브
- 미가공
- 마이크로소프트
- MyTread
- do it c
- C언어
- SSG
Archives
- Today
- Total
목록난수 (1)
History

일반적으로 난수를 생성하려면 time.h 헤더와 stdlib.h 헤더를 include 해줘야 한다. #include #include //srand 함수를 사용하기 위해서 #include //time 함수를 사용하기 위해서 int main() { int arr[16] = {}; //16개의 값을 담을 수 있는 배열 생성 srand((unsigned int)time(NULL)); //난수를 발생시키기 위해 난수 세팅 for (int i = 0; i < 15; i++){ arr[i]=rand() % 20; //0~19의 난수가 배열안에 대입 } for (int i = 0; i < 15; i++){ printf("%d ", arr[i]); //출력 } } 위와 같이 평범하게 난수를 발생시키면 위와 같이 중복 값..
C,C++/개념 실습 프로그래밍
2022. 9. 25. 20:23