基本信息
源码名称:操作系统上机实验.pdf
源码大小:0.41M
文件格式:.pdf
开发语言:C/C++
更新时间:2020-10-20
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 3 元 
   源码介绍
进程创建实验
代码中会设置一些细微错误 检验个人能力


#include <stdio.h>

#include <string.h>

#include <time.h>

#include <windows.h>   //Sleep()

void main(int argc,char **argv)    //执行时可带参数的程序

{

        unsigned int wt,x=1;

        if (argc>=2)

                 x=1 atoi(argv[1]);

        x=x*(unsigned int)time(NULL);

        srand(x); // 使用当前时间为随机序列的"种子"

        char Title[30]="Process ";

        if (argc>=2)

        {

                 strcat(Title,argv[1]);

                 SetConsoleTitle(Title);   //设置标题栏

        }

        for (int i=1;i<=30;i )

        {

                 //显示进程正在运行的信息,其中命令参数argv[1]作为进程的编号

                 printf(" %2d : Process ",i);

                 if (argc>=2)

                         printf("%s ",argv[1]);

                 printf("正在运行!\n");

                 wt = 200 rand() % 500 rand() % 1000;

                 wt= rand() % wt 300;

                 Sleep(wt);        //睡眠等待200~2000ms

        }

}