#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void create_matrix (int matriz[8][8], int i, int j)
{
srand (time (NULL));
for (i=0;i<8;i++)
{
for (j=0;j<8;j++)
{
matriz[i][j]=rand()%7+1;
}
}
}
//___________________________________________________
void check_matrix(int matriz[8][8], int i, int j)
{
for (i=0;i<8;i++)
{
for (j=0;j<8;j++)
{
while (matriz[i][j] == matriz[i+1][j] && matriz[i+1][j] == matriz [i+2][j] || matriz [i][j] == matriz [i][j+1] && matriz [i][j+2])
{
matriz[i][j]=rand()%7+1;
}
}
}
}
//___________________________________________________
void print_matrix (int matriz[8][8], int i, int j)
{
for (i = 0; i < 8 ; i++)
{
for (j=0;j<8;j++)
{
printf("%d ", matriz[i][j]);
}
printf ("\n");
}
}
//___________________________________________________
void change_position(int matriz[8][8], int i, int j)
{
printf ("Select the line. ");
scanf ("%d", &i);
printf ("Select the column. ");
scanf ("%d", &j);
}
//___________________________________________________
int main()
{
int matriz[8][8], i=0, j=0;
create_matrix (matriz, i, j);
check_matrix (matriz, i, j);
print_matrix (matriz, i, j);
change_position (matriz, i, j);
printf ("\n");
system ("pause");
return 0;
}
答案 0 :(得分:4)
看起来在change_position上方的print_matrix缺少一个右大括号
答案 1 :(得分:2)
函数print_matrix
似乎有错误:您打开三个括号,但只关闭其中两个。