VC6.0求解,检查N遍,改变数据结果不变(win7,64位机老觉得有问题)
运行结果总是 a[i]>b[i] 10 times#include<stdio.h>
void main()
{int large(int x,int y);
int a[10],b[10];
int i,m=0,n=0,k=0;
printf("Enter a:\n");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
printf("\n");
printf("Enter b:\n");
for(i=0;i<10;i++)
scanf("%d",&b[10]);
printf("\n");
for(i=0;i<10;i++)
{
if(large(a[i],b[i])==1)
n=n+1;
else
if(large(a[10],b[10])==0)
m=m+1;
else k=k+1;
}
printf("a[i]>b[i] %d times\na[i]=b[i] %d times\na[i] %d times\n",n,m,k);
if(n>k)
printf("arrary a>b\n");
else
if(n<k)
printf("arrry a<b\n");
else
printf("arrry a=b\n");
}
large(int x,int y)
{int flag;
if(x>y)
flag=1;
else if (x<y)
flag=-1;
else flag=0;
return (flag);
}