搜索
查看: 5265|回复: 16
打印 上一主题 下一主题

[原创] 会变化的程序

[复制链接]
楼主
发表于 2012-10-18 19:40:55 | 显示全部楼层
看看~..
沙发
发表于 2012-10-20 21:54:41 | 显示全部楼层
本帖最后由 梦中的婚礼 于 2012-10-20 22:02 编辑

为了方便,
用了很多的无用头文件。。。
其实这是调用了随机的函数。。
大家试试下面这段代码:
#include <stdio.h>
#include <windows.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>
#include <stdlib.h>
#include <malloc.h>
#include <dos.h>
#include <time.h>
#include <ctype.h>
main()
{
int b;
srand( (unsigned)time( NULL ) );
b=rand()%3+1;
    {
  if(b==1)
   {
    system("color c5");
                                printf("红色");
               
               
                        }
  if(b==2)
   {
    system("color e6");
                                printf("黄色");
               
                        }
  if(b==3)
   {
    system("color d5");
                                printf("紫色");
               
                        }
    }
    getch();
    return 0;
           
}

我不知道到底是不是这种原理。。

点评

应该是由时间随机数得来的吧,恩  发表于 2013-4-19 16:13
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

广播台
特别关注
快速回复 返回顶部 返回列表