티스토리 뷰
반응형
#include "stdio.h"
#include "stdlib.h"
//랜덤 값 뽑아주는 라이브러리 사용을 위해 stdlib.h 포함시킨다.
void main() {
int i;
srand(time(NULL));
for(i = 0; i < 10; i++) {
printf("%d ", rand()%20+10);
//10부터 29까지의 난수를 10개 출력함.
}
}
자세한 설명은 생략한다.
반응형
'개인공부 > C and C++' 카테고리의 다른 글
[C 언어] for, while, do while 문 실행순서 확인 (0) | 2015.01.22 |
---|---|
[Qt 4.8] 01. Hello World 프로그램 (1) | 2014.11.15 |
[Qt 4.8] 00. Linux 설치 환경 Setting하기 (0) | 2014.11.15 |
fseek와 ftell 함수 (0) | 2014.01.17 |
구조체 파일 위치 지시자 (0) | 2014.01.17 |
struct member alignment(구조체 멤버 정렬)에 대해 (0) | 2014.01.16 |
realloc, calloc 함수 및 예제 (1) | 2014.01.16 |