I would like to ask,
after I have input the value of the row number and column number of a chess,
what method should I use to put that chess into correct location.
for example, If I input ( r = 5, c = 5)
the chess should be located at ( 5, 5)
that is:
the output should be
________________
1 2 3 4 5 6 7 8 9
1
2
3
4
5 *
6
7
8
9
_________________
but I do not know how to use array to finish the program
Can anyone give some hints?
thank you for your help
圖片參考:http://http.cdnlayer.com/dreamincode/forums/style_emoticons/default/smile.gif
the below is my code
_________________
#include <stdio.h>
int main()
{
int row;
int column;
int r, c;
printf("Please input the row no. & column no. of the stone: ");
scanf("%d %d", &r, &c);
for ( row = 1; row <= 9; row ++ ){
printf(" %d", row);
}
printf("\n");
for ( column = 1; column <= 9; column ++ ){
printf("%d \n", column);
}
if ( r > 9 || c > 9 || r < 1 || c < 1 ){
printf("Wrong number! Input again!\n");
}
return 0;
}