// 流水作业调度.cpp : 定义控制台应用程序的入口点。 #include"stdafx.h"
#include <iostream>
#include<iomanip>
using namespace std;
static int NUM;
struct JOB
{
int a;// 1st
int b;// 2nd
bool type;//mark a>b or b>a
int index;//save initial subscript
};
void Sort( JOB* );
void Input( JOB* );
void Output(JOB*);
void Order(JOB*);
int _tmain(int argc, _TCHAR* argv[])
{
cout << "请输入要加工的工件数量:";
cin >> NUM;
JOB* work=new JOB[NUM];
cout << "请输入数据:\\n";
Input(work);
Sort(work);
Order(work);
Output(work);
delete work;
return 0;
}
void Sort( JOB* temp )
{
int b =0, c = 0;
for (int a = 0; a < NUM; a++)
{
if (temp[a].type == 0)//count
b++;// num of type 0
else
c++;// num of type 1
}
JOB* wo = new JOB[b];