當前位置:係統粉 > 電腦問答 > 其他問答 > 求助!一個C語言小程序.

求助!一個C語言小程序.

提問者:qqq8392630  |  瀏覽 次  |  提問時間:2017-01-29  |  回答數量:9

求助!一個C語言小程序.有道例題:有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

柚子407405158

回答數:5  |  被采納數:23

2017-01-29 17:45:31
如果i不等於k且i不等於j且j不等於k
讚 0
maoqiu199911

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 &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(6) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(6) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(6) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(6) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(6) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(7) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(7) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(7) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(7) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(8) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(8) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(8) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(8) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(9) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(9) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(9) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(9) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(9) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(9) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(10) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(11) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(12) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(12) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(12) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(12) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(12) : error C2018: unknown character &#39;0xa1&#39;
C:\Documents and Settings\Administrator\桌麵\u.c(12) : error C2018: unknown character &#39;0xa1&#39;
執行 cl.exe 時出錯.

u.obj - 1 error(s), 0 warning(s)


怎麼我編譯時,會出錯的!
讚 21
飛雪濺影

飛雪濺影

回答數:63  |  被采納數:86

2017-01-29 22:50:35
哈哈,這麼搞笑?
讚 6
huaming119

huaming119

回答數:15  |  被采納數:90

2017-01-29 17:48:01
也就是說應該是:
if (i!=k && i!=j && j!=k)這麼分開吧,唉,對運算符的優先級還是有點暈哈。
3樓的朋友,不知道你編譯完怎麼成了那樣,是不是跟你將它放在桌麵上了有關係?
讚 1
林愛新蘭

林愛新蘭

回答數:70  |  被采納數:88

2017-01-29 17:16:33
你是不是用了全角標點?
讚 7
汝鄢倩

汝鄢倩

回答數:32  |  被采納數:37

2017-01-29 22:14:23
看不懂哦·55
讚 3
死神之夢無痕

死神之夢無痕

回答數:20  |  被采納數:121

2017-01-30 08:47:12
我也納悶3樓的朋友怎麼會出現那種情況,誰能給解答下~~~
讚 2
神炮ty

神炮ty

回答數:143  |  被采納數:119

2017-01-29 18:47:01
if (i!=k&&i!=j&&j!=k)  表示i不等於k且i不等於j且j不等於k 也就是各數字不重複."!="表示不等於的意思
第一次回答問題,不知道,你是否滿意
讚 14
星馨genie

星馨genie

回答數:217  |  被采納數:38

2017-01-30 05:00:11
忘了說了
運算符的優先級:從高到低 !--算數運算符--關係運算符--&&--||--賦值運算符
讚 21
解決方法
版權信息

Copyright @ 2011 係統粉 版權聲明 最新發布內容 網站導航