Code:
include <stdio.h>
void display(int mapdis[10][10])
{
/* the start of the array */
printf("\n\n\n");
printf("WELCOME TO THE MAPPING PROGRAM\n");
printf("\n");
printf("\n");
int row, col;
for (row=0; row<10;row++)
{
for (col=0;col<10;col++)
{
printf("%4d", mapdis[row][col]);
}
printf("\n");
}
}
void sum(int mapdist [10][10])
{
int x, y;
printf("enter the first Point\n");
scanf("%d", &x);
printf("enter the Second Point\n");
scanf("%d", &y);
printf("the Distance selected is %d\n " + mapdist[x][y]);
printf("x is %d\n ", x);
printf("y is %d\n ", y);
}
int main(void)
{
int mapdist[10][10] ={0,4,5,6,7,8,9,8,7,6,
2,0,4,5,6,7,8,9,8,7,
1,2,0,4,5,6,7,8,9,8,
2,3,4,0,6,7,8,9,8,7,
3,4,5,6,0,8,9,8,7,6,
4,5,6,7,8,0,8,7,6,5,
5,6,7,8,9,8,0,6,5,4,
6,7,8,9,8,7,6,0,4,3,
7,8,9,8,7,6,5,4,0,2,
8,9,8,7,6,5,4,3,2,0};
display(mapdist);
sum(mapdist);
return 0;
}
any suggestions would be useful thanks