Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- 백준
- 개발
- 자바
- backend
- java
- 코스닥
- 풀스택프레임워크
- Reflex
- frontend
- 개인프로젝트
- 프로그래밍
- Project
- 이웃한 칸
- 주가예측
- SNS
- 코딩테스트
- 자바독학
- C++
- 코테
- 프로그래머스
- java정리
- 코딩
- 프로그램
- 빅데이터
- 자바정리
- 개발자
- 사물인터넷
- 코딩독학
- Python
- 모의 주식
Archives
- Today
- Total
Creative Code
dice.c(주사위 값 srand함수) 본문
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
srand(time(NULL)); // seed, 1970년 1월1일부터 몇 초가 지나는지 파악(즉 1초이내에 파일을 두 번이상 사용하면 소용 x)
for (int i = 1; i<=10; i++){
int num = rand()%6+1;
printf("%d\n",num);
}
return 0;
}
'C Programming' 카테고리의 다른 글
lotto.c (로또 번호 생성) (0) | 2023.08.02 |
---|---|
baseball.c(숫자 야구게임) (0) | 2023.08.02 |
dice.c (주사위 값 rand함수) (0) | 2023.08.02 |
bubbleSorting.c ( 배열 버블정렬) (0) | 2023.08.02 |
selectionSorting.c (배열 값 정렬) (0) | 2023.08.02 |