xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

資源簡(jiǎn)介

在Linux環(huán)境下,用C++語(yǔ)言編寫(xiě)一個(gè)程序,以樹(shù)狀結(jié)構(gòu)(即體現(xiàn)父子關(guān)系)輸出系統(tǒng)當(dāng)前所有進(jìn)程。 通過(guò)/proc目錄獲得各進(jìn)程的父進(jìn)程ppid,獲得進(jìn)程樹(shù)的父親表示,再將進(jìn)程樹(shù)的父親表示轉(zhuǎn)換成左孩子與右孩子,最后中序遍歷二叉樹(shù),輸出進(jìn)程信息即可。

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?
#include?
using?namespace?std;

struct?pid_info{???//store?processes‘?information
int?pid;???//pid
int?ppid; //parent?pid
char?process_name[1024]; //process?name
pid_info*?child; //child?node
pid_info*?next_sibling; //brother?node
pid_info():child(NULL)next_sibling(NULL)pid(0)ppid(0){}??//initialize
pid_info(pid_info&?pi){???//copy?constructor
pid?=?pi.pid;
ppid=pi.ppid;
strcpy(process_namepi.process_name);
child?=?pi.child;
next_sibling?=?pi.next_sibling;
}
pid_info&operator?=?(const?pid_info&?pi){???//operator?=?overload
if(this?==?&pi)
return?*this;
pid?=?pi.pid;
ppid=pi.ppid;
strcpy(process_namepi.process_name);
child?=?pi.child;
ne

評(píng)論

共有 條評(píng)論