我在 Visual express 2010 中工作,在我的练习项目中,我有一个六列和大约 1350 行的数组。这个想法是检查数组中重复出现的数字并打印整行。当我尝试阅读和打印它时,我认为它只检查前五行。它不会识别出现在这五行之后的数字。请帮助我,我在这里添加了一个用于验证的行数较少的代码。
#include <stdio.h>
#include <conio.h>
#include <malloc.h>
unsigned const int arr[][6];
void main()
{
unsigned int flag = 0;
unsigned int i,j,col=5,row=5,input,k;
printf("\nPlease enter the number to be checked: \n");
scanf("%d",&input);
for(i=0;i<=row;i++)
{
for(j=0;j<=col;j++)
{
if(input==arr[i][j])
{
flag = 1;
for(k=0;k<=col;k++)
printf("%d \t",arr[i][k]);
printf("\n");
//break;
}
}//if(flag==1)
//break;
}
if(flag==0)
printf("oops...\n");
else
flag=0;
getch();
}
unsigned int arr[][6]={
9, 16, 22, 33, 4, 37,
4, 12, 27, 28, 29, 30,
7, 15, 19, 21, 25, 41,
8, 18, 19, 25, 26, 29,
5, 7, 10, 26, 29, 32,
2, 4, 7, 19, 25, 27,
2, 10, 14, 22, 23, 34,
1, 8, 16, 31, 40, 43,
3, 8, 15, 16, 23, 25,
5, 24, 31, 36, 40, 44,
3, 9, 20, 29, 36, 44,
18, 21, 24, 25, 26, 44,
2, 8, 12, 15, 22, 35,
4, 9, 28, 32, 35, 39,
18, 19, 20, 29, 32, 40,
14, 16, 29, 41, 42, 43,
2, 6, 27, 35, 41, 44,
7, 9, 11, 20, 28, 36,
10, 16, 22, 23, 27, 37,
8, 10, 14, 29, 35, 38,
2, 10, 18, 27, 28, 36,
2, 11, 17, 29, 32, 40,
4, 7, 17, 23, 33, 37,
7, 26, 29, 31, 33, 38,
2, 8, 18, 33, 35, 41,
1, 5, 14, 36, 41, 44,
9, 12, 17, 24, 30, 44,
8, 12, 16, 33, 38, 40,
4, 6, 12, 13, 25, 32,
7, 15, 31, 32, 38, 43,
9, 14, 15, 18, 19, 25,
7, 11, 21, 32, 40, 45,
2, 3, 29, 30, 35, 43,
1, 4, 14, 16, 30, 45,
18, 19, 20, 28, 33, 36,
1, 12, 18, 20, 26, 42,
1, 6, 8, 30, 32, 41,
1, 2, 12, 15, 38, 39,
11, 23, 31, 33, 40, 42,
3, 8, 13, 17, 31, 39,
23, 33, 34, 37, 38, 39,
1, 6, 8, 27, 33, 39,
7, 22, 23, 35, 37, 45,
12, 14, 24, 32, 37, 40,
4, 6, 7, 25, 29, 42,
2, 11, 15, 19, 27, 31,
6, 11, 20, 31, 35, 44,
3, 12, 26, 33, 41, 44,
7, 9, 14, 20, 35, 41,
13, 16, 19, 40, 41, 44,
17, 23, 25, 36, 39, 43,
7, 10, 11, 16, 32, 33,
4, 16, 17, 27, 41, 42,
12, 13, 18, 34, 40, 45,
26, 29, 38, 41, 43, 44,
9, 12, 24, 25, 26, 43,
1, 2, 16, 24, 32, 38,
23, 26, 27, 36, 38, 44,
19, 21, 25, 27, 42, 45,
5, 10, 21, 22, 25, 27,
8, 19, 21, 31, 33, 42,
5, 7, 8, 13, 39, 45,
2, 10, 11, 14, 43, 44,
3, 8, 9, 24, 31, 39,
2, 3, 17, 26, 29, 44,
10, 14, 27, 28, 41, 43,
9, 21, 25, 27, 34, 37,
10, 17, 25, 27, 41, 42,
11, 12, 15, 25, 34, 35,
13, 26, 38, 41, 43, 44,
17, 20, 25, 30, 32, 40,
1, 2, 8, 12, 16, 20,
1, 12, 13, 34, 36, 39,
29, 32, 34, 37, 41, 42,
19, 20, 23, 31, 35, 36,
4, 6, 8, 12, 17, 18,
4, 11, 12, 18, 19, 23,
6, 8, 14, 15, 19, 44,
3, 11, 14, 22, 32, 40,
13, 21, 25, 31, 41, 42,
7, 10, 16, 17, 26, 28,
6, 7, 8, 11, 21, 29,
3, 8, 27, 33, 34, 38,
5, 11, 15, 18, 36, 42,
4, 10, 15, 19, 24, 34,
3, 6, 12, 28, 41, 42,
3, 8, 26, 27, 36, 42,
5, 9, 15, 24, 30, 44,
2, 5, 22, 25, 37, 43,
3, 10, 16, 26, 28, 31,
8, 9, 21, 23, 35, 44,
7, 10, 16, 20, 22, 42,
2, 6, 8, 11, 37, 40,
6, 14, 16, 26, 33, 45,
2, 5, 6, 20, 22, 40,
2, 3, 7, 15, 16, 26,
5, 6, 7, 22, 26, 34,
3, 18, 31, 36, 39, 44,
9, 22, 25, 26, 31, 35,
1, 18, 20, 37, 42, 43,
2, 3, 5, 24, 25, 42,
6, 15, 22, 33, 35, 45,
4, 18, 21, 30, 32, 33,
20, 27, 33, 34, 38, 41,
15, 20, 22, 25, 40, 43,
3, 22, 26, 31, 36, 40,
26, 33, 35, 40, 41, 45,
21, 26, 32, 36, 42, 43,
5, 13, 21, 31, 38, 45,
3, 9, 20, 28, 29, 32,
10, 20, 21, 23, 25, 38,
11, 13, 16, 19, 24, 43,
1, 5, 9, 18, 33, 34,
};