请教如何产生1-99的随机数
解决方案 »
- 问题多多,一个接一个,关于Tooltip提示
- 迫切想提高自己的能力,请大家给些建议!!!希望支持,顶者有分!!!!内详
- 请问怎样获得一个程序的实例句柄?
- 如何根据一窗口句柄,得到dc,然后在dc上作图?
- 问一个很弱的问题,掩码有255.255.255.243的吗?(我在一篇文章中看到的,很奇怪)
- 请教个问题啊!!!!
- 为什么不能处理WM_KEYDOWN消息?---来者给分!
- 如何在 idl 中插入预处理 #define 定义
- C++ Report是国外著名的C++杂志吧,有谁知道其网站及相关信息的查询处!!!!
- 串口通讯,MSCOMM控件问题~~请教达人
- 五一了,发点搞笑的让大家都开心开心
- 1000 分 求 3D网游辅助外挂 VC 编的原码或相关教程!!
#include <stdio.h>
#include <time.h>void main( void )
{
int i; /* Seed the random-number generator with current time so that
* the numbers will be different every time we run.
*/
srand( (unsigned)time( NULL ) ); /* Display 10 numbers. */
for( i = 0; i < 10;i++ )
printf( " %d\n", rand()%100 );
}
* with the time, then displays 10 random integers.
*/#include <stdlib.h>
#include <stdio.h>
#include <time.h>void main( void )
{
int i; /* Seed the random-number generator with current time so that
* the numbers will be different every time we run.
*/
srand( (unsigned)time( NULL ) ); /* Display 10 numbers. */
for( i = 0; i < 10;i++ )
printf( " %6d\n", rand() );
}
Output 6929
8026
21987
30734
20587
6699
22034
25051
7988
10104
这么认真负责啊,
让我学到好多东西,由衷的感谢