#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
struct cost
{
int pointA;
int pointB;
int cost;
};
int main()
{
int i=0,j=0,n;
int eachcost[5][5]={
{0,8,2,0,10},
{0,0,7,0,9},
{0,0,0,15,0},
{0,0,0,0,3},
{0,0,0,0,0}
};
/* 老董給的
0 1 2 3 4
---------------
0 |0 8 2 0 10
1 |0 0 7 0 9
2 |0 0 0 15 0
3 |0 0 0 0 3
4 |0 0 0 0 0 */
struct cost point[5][5];
struct cost ppprint;
ppprint=point[i][j];
printf("A,B (Cost)\n---------------\n");
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
if(eachcost[i][j]!=0)
{
point[i][j].pointA = i;
point[i][j].pointB = j;
point[i][j].cost = eachcost[i][j];
ppprint=point[i][j];
printf("%d,%d (%d)\n",ppprint.pointA,ppprint.pointB,ppprint.cost);
}
}
}
system("PAUSE");
}
留言列表