摘要:{if((temp<tempArray[j])&&(sortResult[j]==0)){temp=tempArray[j];index=j;}}//对w[i]作标记排序if(sortResult[index]==0){sortResult[index]=++k;}}//修改效益最低的sortResult[i]标记for(i=0;i<n;i++){if(sortResult[i]==0){sortResult[i]=++k;}}return
{
if ((temp < tempArray[j]) && (sortResult[j] == 0))
{
temp = tempArray[j];
index = j;
}
}
//对w[i]作标记排序
if (sortResult[index] == 0)
{
sortResult[index] = ++k;
}
}
//修改效益最低的sortResult[i]标记
for (i = 0; i < n; i++)
{
if (sortResult[i] == 0)
{
sortResult[i] = ++k;
}
}
return;
}
//得到本算法的所有输入信息
void getData(float p[], float w[], int *n)
{
int i = 0;
printf(“please input the total count of object: ”);
scanf(“%d”, n);
printf(“Please input array of p :\n”);
for (i = 0; i < (*n); i++)
{
scanf(“%f”, &p[i]);
}
printf(“Now please input array of w :\n”);
[1] [2] [3] [4] [5] [6] [7]