Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int main()
  6. {
  7. srand(time(NULL)); // 用目前電腦時間來設定亂數種子
  8. int n = rand(); // 隨機產生 0 ~ 32767
  9. printf("亂數 = %d\n", n);
  10.  
  11. printf("按 Enter 繼續...");
  12. getchar(); // 輸入一個字元,效果與 scanf("%c" ... 相同
  13. fflush(stdin); // 清除緩衝區
  14.  
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement