ex6_03.c

来自「[C语言入门经典(第4版)]整本书的源码!值得推荐!全部是最简单的源码!」· C语言 代码 · 共 21 行

C
21
字号
/* Exercise 6.3 A random thought for the day */
#include <stdio.h>
#include <time.h>
#include <stdlib.h>

int main(void)
{
  char thoughts[][50] = {"Wherever you go, there you are!",
                         "A nod is as good as a wink to a blind horse.",
                         "Many hands make light work.",
                         "Too many cooks spoil the broth.",
                         "A rolling stone gathers no moss.",
                         "A wise man will cover the hole in his carpet."};

  srand((unsigned int)time(NULL));

  printf("Today's thought is:\n%s\n", thoughts[rand()%(sizeof thoughts/sizeof thoughts[0])]);
  return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?