Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main()
- {
- srand(time(NULL)); // 用目前電腦時間來設定亂數種子
- int n = rand(); // 隨機產生 0 ~ 32767
- printf("亂數 = %d\n", n);
- printf("按 Enter 繼續...");
- getchar(); // 輸入一個字元,效果與 scanf("%c" ... 相同
- fflush(stdin); // 清除緩衝區
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement