结构体指针实现的银行家算法C++版

#define _CRT_SECURE_NO_WARNINGS
#include<stdlib.h>
#include <iostream>
using namespace std;

struct allocation {
   
	int value;
	allocation *next;
};
struct max {
   
	int value;
	max *next;
};
struct available {
   
	int value;
	available *next;
};
struct need {
   
	int value;
	need *next;
};
struct path {
   
	int value;
	path *next;
};
struct finish {
   
	int stat;
	finish *next;
};

int main() {
   
	int row, colum, status = 0, i, j, k, l, t, temp, processtest;
	allocation *allochead = new allocation;
	allocation *allocation1 = allochead;
	
	max *maxhead = new max;
	max *max1 = maxhead;
	
	available *avahead = new available;
	available *available1 = avahead;
	available *workhead = new available;
	available *work1 = workhead;
	
	need *needhead = new need;
	need *need1 = needhead;
	
	finish *finihead = new finish;
	finish *finish1 = finihead;
	
	path *pathhead = new path;
	path *path1 = pathhead;

	printf("请输入系统资源的种类数:");
	scanf("%d", &colum);
	printf("请输入现在内存中的进程数:");
	scanf("%d", &row);
	printf("请输入已分配资源矩阵:\n");

	for (i = 0; i < row; i++)
	{
   
		for (j = 0; j < colum; j++)
		{
   <
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值