同樣的問題不要發問2次
你還有同學也問一樣的問題
http://tw.knowledge.yahoo.com/question/index?qid=1004121902144
上面那位老大的程式要改一下
我還以為這程式是你寫的
http://tw.knowledge.yahoo.com/question/?qid=1004121903300
原來是別人先回應你在把他複製貼上
唉......
真不知道我是幫你還是害你
有點幫人還失落的感覺
------------------------
#include
#include
void main()
{
int a1[5],a[5],i,j,m,c,b,flag,k;
flag=0;
randomize();
clrscr();
do{
a1[1]=random(10);
a1[2]=random(10);
a1[3]=random(10);
a1[4]=random(10);
if ((a1[1]==a1[2]) || (a1[1]==a1[3]) || (a1[1]==a1[4]) || (a1[2]==a1[3]) || ( a1[2]==a1[4]) || (a1[3]==a1[4]))
{;}
else
{flag=1;}
} while (flag==0);
/*this is answer */
/*printf("\n\ni find%d%d%d%d",a1[1],a1[2],a1[3],a1[4]);*/
for (k=1;k<=10;k++)
{c=0;b=0;
printf("input %d times(total 10 times),please input number :",k);
scanf("%d",&m);
if((m<123)||(m>9876))
{printf("\nError!! please enter a correct 4 numbers (norepead)\n");
continue;
}
a[1]=m/1000;
a[2]=(m/100)%10;
a[3]=(m/10)%10;
a[4]=m%10;
for (i=1;i<=4;i++)
if (a[i]==a1[i]) c=c+1;
for (i=1;i<=4;i++){
for (j=1;j<=4;j++){
if (a[i]==a1[j]) {b=b+1;}
}
}
if ((a[1]==a[2]) || (a[1]==a[3]) || (a[1]==a[4]) || (a[2]==a[3]) || ( a[2]==a[4]) || (a[3]==a[4]))
{continue;}
if(c!=4)
{printf("Computer : %dA%dB\n\n",c,b-c);}
else
{printf("\n\nIt is the answer . You Are Right!! .\n");
break;
}
}
if(k>10)
printf("The Real Number is %d%d%d%d .",a1[1],a1[2],a1[3],a1[4]);
getchar();
getchar();
}
2004-12-24 17:47:20 補充:
對阿!!所以不會以後在好心的幫別了,這樣可以了吧
2004-12-24 18:07:30 補充:
同樣問題回答3次我還要照別人風格去改你以為我時間多嗎?
2004-12-27 00:15:00 補充:
給樓上:你能這麼想就知道你愛台灣啦!!!