易截截图软件、单文件、免安装、纯绿色、仅160KB

如何用C产生0 99随机数?

#include <stdlib.h>
#include<stdio.h>
#include<time.h>
#define randomize() srand((unsigned)time(NULL)) //定义一个宏
int main(void)
{
int i;
printf("Ten random numbers from 0 to 99\n\n");
randomize();
for(i=0; i<100; i++)
{
printf("%d\n", rand() % 100);
sleep(1);
}
return 0;
}
<运行>
root@farsight:/mnt/hgfs/E/yinhui/12.3/msg# gcc tttt.c -o tttt
root@farsight:/mnt/hgfs/E/yinhui/12.3/msg# ./tttt
Ten random numbers from 0 to 99
87
80
68
39
39
53
14
96
46


相关文档:

生产者 消费者问题实现 (linux下C语言)

操作系统的一个经典问题是"生产者-消费者"问题, 这涉及同步信号量和互斥信号量的应用, 在这里,我用线程的同步和互斥来实现.
/*
* author 张文
* 2008/06/20
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h> ......

c与c++的static函数


c与c++ static函数的区别
本文转自:http://blog.csdn.net/lipps/archive/2007/05/18/1615419.aspx
static关键字是C, C++中都存在的关键字, 它主要有三种使用方式, 其中前两种只指在C语言中使用, 第三种在C++中使用(C,C++中具体细微操作不尽相同, 本文以C++为准).
(1)局部静态变量
(2)外部静态变 ......

C %m.ns 输出

#include <stdio.h>
#define N 19
int main()
{
int i;
for (i=0;i<=N;i++)
{
printf("%*.*s%-*.*s\n",N,i<=N/2?i:N-1,"*******************",\
N,i<=N/2?i+1:N-i+1,"*******************");
}
return 0;
}

%m.ns ......

C/C++应聘总结[特别推荐给大三的学弟学妹们]


搞软件是有搞头的
——邹祁峰
2009年12月3日
 
声明:所说的只针对C、C++、.NET专业的同学,对其他专业也许没有参考价值!
[推荐给大三的学弟学妹们]
【欢迎各位朋友补充】
 
    对我个人而言,大学毕业找工作算是画上了一个许多人羡慕,但我自己仍感遗憾的句号。找工作期间 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号