如何用c语言让计算机自动生成1到100之间的一个整数?
能不能把代码也放上来?
加个srand(time(NULL)); #include
#include
int main()
{
srand(time(NULL));
printf("%3d",rand()%100+1);
return 0;
}
[bpf1@test65 c]$
#include<stdio.h>
#include<stdlib.h>
int main()
{
printf("%3d",rand()%100+1);
return 0;
}
#include <time.h>
int main()
{
int i;
srand((unsigned int)time(NULL));
printf("%d\n",rand()%100+1);
system("pause");
return 0;
}
#include
#include
void main()
{
srand(time(NULL));
printf("%d\n",rand()%100+1);
}