資源簡介
采用 讀取 文件的形式編寫的~~~通過讀入文件中的數據來實現銀行家的算法~~
忘記傳讀取文件了,在我的資源里面有,下完這個去我的資源里找一下"銀行家算法的文件格式"就行了
代碼片段和文件信息
#include?
#include?
#include?
using?namespace?std;
#define?null?0
struct?bankers
{
????char?name[10];
int?resource[10];
int?allocation[10];
int?need[10];
int?type;
}process[100];
struct?bankers_copy1
{
????char?name_copy1[10];
int?resource_copy1[10];
int?allocation_copy1[10];
int?need_copy1[10];
int?type_copy1;
}process_copy1[100];//恢復數據用
struct?bankers_copy
{
????char?name_copy[10];
int?resource_copy[10];
int?allocation_copy[10];
int?need_copy[10];
int?work[10];
}process_copy[100];//存序列
int?process_numberresource_number;
int?max[10]={1057};
int?max_now[10]={1057};//存當前資源
int?max_now1[10];
int?max_now2[10];
int?number[10];
int?middle[10];
void?init()
{
int?total=0;
while(total {
sc
- 上一篇:自適應模糊pidC代碼
- 下一篇:操作系統習題——可變分區存儲管理
評論
共有 條評論