怎麼用C語言下去編寫排列組合 |
尚未結案
|
stardust0218
一般會員 發表:1 回覆:0 積分:0 註冊:2004-11-23 發送簡訊給我 |
我想用C寫出一個排列組合的程式
功能是
在26個英文字母中取出部份字母做排列
輸入一個數字(代表個數)
則程式會自動跑出該數字所有的字母排列組合
例如:
輸入1=>A
輸入2=>AB,BA
輸入3=>ABC,ACB,BAC,BCA,CAB,CBA
...等等
從0到26 由於我不是很懂C(幾乎不懂)
所以完全不知道該怎麼樣把程式架構起來
希望各位高手大大可以給我個方向
好讓我去想如何編寫
拜託<(_ _)> 發表人 - stardust0218 於 2004/11/24 00:40:59
|
allenchan
資深會員 發表:10 回覆:306 積分:283 註冊:2004-01-06 發送簡訊給我 |
這段程式碼是從 C 名題精選百則偷來的,加上一小點的修改,程式是利用旋轉法來排列所有組合: 比方說:A B C 的排列,結果如下: A B C
C A B
B C A
B A C
C B A
A C B 旋轉一圈來排列所有的結果。
#include發表人 - allenchan 於 2004/11/25 03:42:44 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |