- 博客(0)
- 资源 (2)
空空如也
银行家算法源程序觉得能用
下面是部分程序
#include<string.h>
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<iomanip>
#include<conio.h>
#define M 5 //定义进程数
#define N 3 //定义资源数
#define False 0
#define True 1
int Max[5][3]={{7,5,3},{3,2,2},{9,0,2},{2,2,2},{4,3,3}}; //每个进程对每类资源的最大需求
int Allocation[5][3]={{0,1,0},{2,0,0},{3,0,2},{2,1,1},{0,0,2}};//系统已分配资源
int Avaliable[3]={3,3,2}; //系统可利用资源
int Need[5][3]={{7,4,3},{1,2,2},{6,0,0},{0,1,1},{4,3,1}};//还需要资源
int Request[3];
//显示版权信息函数
void xinxi()
{
printf("\n\n");
printf(" \t┏━━━━━━━━━━━━━━━━━━━━━━━┓\n");
printf(" \t┃ *****资源管理***** \n");
printf(" \t┠———————————————————————┨\n");
printf(" \t┃ 可在此填入版权说明 \n");
printf(" \t┃ \n");
printf(" \t┃ \n");
printf(" \t┗━━━━━━━━━━━━━━━━━━━━━━━┛");
printf("\n\n");
}
2011-01-01
计算机网络实现ping.功能的源程序
实现PING功能的源程序
下面是部分程序
#include <Winsock2.h>
#include <Ws2tcpip.h>
#include<stdio.h>
#include <stdlib.h>
#include <math.h>
#pragma comment(lib,"Ws2_32.lib")//Winsock的lib库
//icmp包结构
typedef struct _ICMPPACK
{
unsigned char icmp_type; //消息类型
unsigned char icmp_code; //清息代码
unsigned short icmp_checksum; //16位效验
unsigned short icmp_id;//用来唯一标识些请求的ID号
unsigned short icmp_sequence; //序列号
unsigned long icmp_timestamp; //时间戳
}ICMPPACK, *PICMPPACK;
2011-01-01
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人