當前位置:編程學習大全網 - 編程軟體 - c語言問題,我是初學者,我寫了壹個簡單的猜想,不知道怎麽糾正錯誤的地方。我用的是C-Free5.0。

c語言問題,我是初學者,我寫了壹個簡單的猜想,不知道怎麽糾正錯誤的地方。我用的是C-Free5.0。

請猜猜

Times=1輸入猜數:1。

1A0Btimes=2輸入猜測數字:2

0A1Btimes=3輸入猜測數字:3。

0A1Btimes=4輸入猜測數字:4。

0A1Btimes=5輸入猜測數字:5。

0A0Btimes=6輸入猜測數字:6。

0A0Btimes=7輸入猜測數字:7。

0A0Btimes=8輸入猜測數字:8。

0A0Btimes=9輸入猜測數字:9。

0a0b times = 10輸入猜測數字:0。

0A0Btimes=11輸入猜測號碼:

0A0Btimes=12輸入猜數:5。

0A0Btimes=13輸入猜數:5。

0A0Btimes=14輸入猜數:5。

0A0Btimes=15輸入猜數:5。

0A0Btimes=16輸入猜測號碼:

# include & ltmath.h & gt

# include & ltstdio.h & gt

無效總管(無效)

{

int答案[4]={2,4,1,3},guess,a,b,times=0,I,j;

printf(" please guess \ n ");

而(a!=4)

{

a = 0;

b = 0;

times = times+1;

printf("times=%d ",次);

Printf("輸入壹個猜測:");

scanf("%d ",& amp猜測);

for(I = 3;我& gt-1;我-)

{

for(j = 0;j & lt4;j++)

{

If ((int) (guess/pow (I,10)) = =答案[j])//在網上查這個冪是不對的,雖然百度百科裏有,因為math.h裏沒有這個函數,我在百度百科裏修改了這個詞條。

{

如果(i+j==3)

a = a+1;

其他

b = b+ 1;

}

}

guess=guess-(int)(guess/pow(i,10))*pow(i,10);

}

printf("%dA%dB ",a,b);

}

}

  • 上一篇:2014款奔馳S320可以調波箱裏程數嗎
  • 下一篇:星星網遊txt全集下載
  • copyright 2024編程學習大全網