| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 739 人关注过本帖
标题:求助 关于库函数stdlib.h
只看楼主 加入收藏
FlyFlame
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-7-28
收藏
 问题点数:0 回复次数:2 
求助 关于库函数stdlib.h

请教各位C语言高手,小弟在用VC++6.0编C语言程序时用到了stdlib.h头文件中的函数randomize()和random(),可是VC不认识,总是报错,我在WIN-TC中编译过了,能通过,请问是什么问题,如果不能调用的话,那么在VC中编辑C程序如何表示随机数生成函数呢?先谢谢了!
下面是我的程序:
#include"stdio.h"
#include"stdlib.h"
#include"ctype.h"
void main()
{
int count,
number,
guess;
char yes='Y';
printf("\nNow let us play the game.\n Guess the number:");
while(toupper(yes)=='Y')
{
count=0;
randomize();
number=random(100)+1;
do{
do{
printf("\nInput an integer number(1-100):");
scanf("%d",&guess);
}while(!(guess>=1&&guess<=100));
if(guess<number)
printf("\nYour answer is LOW,try again.");
if(guess>number)
printf("\nYour answer is HIGH,try again.");
count++;
if(count==15)
{
printf("\nThis is the %d times!Think it hard next!");
exit(0);
}
}while(!(guess==number));
if(count<=7)
{
printf("\n You got it in &d times.\n",count);
printf("\n Congretulations!");
}
else
{
printf("\nYou got it in %d times.\n",count);
printf("\nI bet you can do it better");
}
printf("\n NEXT?(Y/N):");
scanf("%c",&yes);
}
}

搜索更多相关主题的帖子: stdlib 函数 
2006-07-28 23:19
SunShining
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:31
帖 子:2215
专家分:0
注 册:2006-2-17
收藏
得分:0 
咦..我记得是在TC下才不能识别randomize()的

难道我记错了

#include <time.h>
srand(time(NULL));


[glow=255,violet,2]闭关修炼ing...[/glow] [FLASH=360,180]http://www./chinaren.swf[/FLASH]
2006-07-28 23:23
boyatec
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2006-7-28
收藏
得分:0 

{}

不匹配

2006-07-29 06:57
快速回复:求助 关于库函数stdlib.h
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015824 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved