[問題] for loop 每幾次就執行
開發平台(Platform): ubuntu codeblock
問題(Question):每到一定的count,
execfunction1() 會把 execfunction2()和execfunction3()產生的值丟出去
code中是每100筆丟過去一次,但是假如我要連 count%till_times 也就是
最後餘數的那些值也要傳過去,ex:總共304筆 每100筆丟過去遇到那剩下
4筆就丟不過去,應該怎樣改會比較洽當
程式碼(Code):
for (i = 0; i < array.size(); i++) {
for (j = 0; j < array2.size(); j++) {
till_times = 100;
if (count > till_times || count = 0) {
count = 0;
execfunction1();
}
if (count <= till_times) {
if (count < till_Times) {
execfuction2();
} else {
execfuction3();
}
count++
}
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 163.22.21.92
※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1413266155.A.C11.html
→
10/14 14:57, , 1F
10/14 14:57, 1F
→
10/14 15:01, , 2F
10/14 15:01, 2F
→
10/14 15:03, , 3F
10/14 15:03, 3F
→
10/14 15:18, , 4F
10/14 15:18, 4F
→
10/14 15:18, , 5F
10/14 15:18, 5F
→
10/14 15:32, , 6F
10/14 15:32, 6F
→
10/14 15:36, , 7F
10/14 15:36, 7F
→
10/14 15:39, , 8F
10/14 15:39, 8F
推
10/14 15:52, , 9F
10/14 15:52, 9F
→
10/14 15:52, , 10F
10/14 15:52, 10F
推
10/17 02:49, , 11F
10/17 02:49, 11F
→
10/17 02:51, , 12F
10/17 02:51, 12F
→
10/17 02:51, , 13F
10/17 02:51, 13F
推
10/18 22:20, , 14F
10/18 22:20, 14F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章