求助!一個C語言小程序.
提問者:qqq8392630 | 瀏覽 次 | 提問時間:2017-01-29 | 回答數量:9
有道例題:有1、2、3、4個數字,能組成多少個互不相同且無重複數字的三位數?都是多少? 程序如下: main() { int i,j,k; printf(\"\\n\"); for(i=1;i<5;i++) for(j=1;j<5;j++) for (k=1;k<5;k++) { if (i!=k&&i!=j&&j!=k) printf(\"%d,%d,%d\\n\",i,j,k); } } 對於其中的:if (i!=k&&i!=j&&j!=k) 這句不太明白,請高手解答下!
已有9條答案
柚子407405158
回答數:5 | 被采納數:23
2017-01-29 17:45:31
如果i不等於k且i不等於j且j不等於k
maoqiu199911
回答數:211 | 被采納數:35
2017-01-29 21:16:07
--------------------Configuration: u - Win32 Debug--------------------
Compiling...
u.c
C:\Documents and Settings\Administrator\桌麵\u.c(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(6) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(7) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(7) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(7) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(7) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(8) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(8) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(8) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(8) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(9) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(9) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(9) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(9) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(9) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(9) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(12) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(12) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(12) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(12) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(12) : error C2018: unknown character '0xa1'
C:\Documents and Settings\Administrator\桌麵\u.c(12) : error C2018: unknown character '0xa1'
執行 cl.exe 時出錯.
u.obj - 1 error(s), 0 warning(s)
怎麼我編譯時,會出錯的!
huaming119
回答數:15 | 被采納數:90
2017-01-29 17:48:01
也就是說應該是:
if (i!=k && i!=j && j!=k)這麼分開吧,唉,對運算符的優先級還是有點暈哈。
3樓的朋友,不知道你編譯完怎麼成了那樣,是不是跟你將它放在桌麵上了有關係?
我也納悶3樓的朋友怎麼會出現那種情況,誰能給解答下~~~
if (i!=k&&i!=j&&j!=k) 表示i不等於k且i不等於j且j不等於k 也就是各數字不重複."!="表示不等於的意思
第一次回答問題,不知道,你是否滿意
星馨genie
回答數:217 | 被采納數:38
2017-01-30 05:00:11
忘了說了
運算符的優先級:從高到低 !--算數運算符--關係運算符--&&--||--賦值運算符