4)<<" "<<P3.find()<<print(&P3)<<endl; cout<<" "<<toolstatus(tools[3])<<endl; cout<<"--------------------------"<<endl; cout<<" 若要继续下一状态,输入 y;输入 n进入死锁;输入其他,结束程序: "; cin>>con; Sleep(20); } while(con=='n') { P1.dead_lock(); P2.dead_lock(); P3.dead_lock(); P4.dead_lock(); P5.dead_lock(); cout<<" 死锁情况"<<endl; cout<<" "<<P1.find()<<print(&P1)<<" "<<endl; cout<<" "<<toolstatus(tools[0])<<" "<<toolstatus(tools[1])<<endl; cout<<" "<<P5.find()<<print(&P5)<<" "<<P2.find()<<print(&P2)<<endl; cout<<" "<<toolstatus(tools[4])<<" "<<toolstatus(tools[2])<<endl; cout<<" "<<P4.find()<<print(&P4)<<" "<<P3.find()<<print(&P3)<<endl; cout<<" "<<toolstatus(tools[3])<<endl; cout<<"--------------------------"<<endl; cout<<" 输入 n继续;输入其他,结束程序: "; cin>>con; Sleep(20); } DeleteCriticalSection (&cs) ; //退出资源区 return 0;}