#include "iostream"
#include <Windows.h>
#include <tchar.h>
using namespace std;

typedef struct node {
	char name;
	int status;
	int precendence;
	int ax, bx, cx, dx;
	int pc;
	int psw;
	struct node *next;
}pcb;


pcb* CreateProcess(pcb* head, int n);
void ProcessFiFo(pcb* ehad);



pcb* CreateProcess(pcb *head, int n) {
	pcb* p, * q;
	head = (pcb*)malloc(sizeof(pcb));
	head->next = NULL;
	p = head;

	for (int i = 0;i < n;i++) {
		q = (pcb*)malloc(sizeof(pcb));
		cout << "请输入第" << i + 1 << "个进程名字:";
		cin >> q->name; 
		cout << "输入进程相关数据：";
		cin >> q->status;
		fflush(stdin);
		q->next = p->next;
		p->next = q;
		p = q;
	}
	return head;
}


void ProcessFiFo(pcb* head) {
	pcb* p;
	p = head->next;
	cout << "进程运行顺序：";
	while (p) {
		cout << p->name;
		p = p->next;
	}
	printf("\n");
}


int _tmain(int argc, _TCHAR* argv[]) {
	pcb* head = nullptr;
	int n;
	cout << "请输入需创建进程个数：";
	cin >> n;
	head = CreateProcess(head, n);
	ProcessFiFo(head);
	return 0;

}