賓果遊戲問題 |
尚未結案
|
Mosquito
一般會員 發表:4 回覆:5 積分:1 註冊:2005-01-04 發送簡訊給我 |
目前的問題出在 /*計算連線數*/
按下第6次按鈕,還沒有第2條連線
但是Memo卻會顯示有2條連線成功
想不透哪裡邏輯出問題
以下是相關的程式碼:
int temp=0; int times = 0 ; int numbercheck = 0 ; int count=0; void TForm1::cleartime() { times = 0; } void TForm1::score_count() { if (times==5) { count ; cleartime(); switch (count) { case 1: score->Lines->Clear(); score->Lines->Append("目 前 連 線 數 一"); break; case 2: score->Lines->Clear(); score->Lines->Append("目 前 連 線 數 二"); break; case 3: score->Lines->Clear(); score->Lines->Append("目 前 連 線 數 三"); break; case 4: score->Lines->Clear(); score->Lines->Append("目 前 連 線 數 四"); break; case 5: score->Lines->Clear(); score->Lines->Append("目 前 連 線 數 五"); temp=1; break; } } else { cleartime(); } } ----------------------------------------------------------------------- void __fastcall TForm1::startnumberClick(TObject *Sender) { /*圈選標記*/ for ( int i = 1; i <=25; i ) { TEdit *edit = dynamic_cast程式大概模型 ★代表Edit ★★★★★ 1~5 ★★★★★ 6~10 ★★★★★ 11~15 ★★★★★ 16~20 ★★★★★ 21~25 發表人 - Mosquito 於 2005/01/05 02:23:56 發表人 - Mosquito 於 2005/01/05 02:26:02 發表人 - Mosquito 於 2005/01/06 00:12:27 |
fffhghgjh
一般會員 發表:2 回覆:33 積分:17 註冊:2004-12-23 發送簡訊給我 |
看了一下貼的程式
發現程式的邏輯上有問題
在score_count中
都先把count清為零
這樣最多只有一條會連線
應當把count放到外部變數
最後再一起判斷連線數
int count=0; void TForm1::score_count() { if (times==5) { count ; } cleartime(); } //再多一個判斷連線數 void TForm1::checkmatchnumber() { switch (count) { case 1: score->Lines->Clear(); score->Lines->Append("目 前 連 線 數 一"); break; case 2: score->Lines->Clear(); score->Lines->Append("目 前 連 線 數 二"); break; case 3: score->Lines->Clear(); score->Lines->Append("目 前 連 線 數 三"); break; case 4: score->Lines->Clear(); score->Lines->Append("目 前 連 線 數 四"); break; case 5: score->Lines->Clear(); score->Lines->Append("目 前 連 線 數 五"); temp=1; break; } }試試看吧 發表人 - fffhghgjh 於 2005/01/05 13:50:00 |
Mosquito
一般會員 發表:4 回覆:5 積分:1 註冊:2005-01-04 發送簡訊給我 |
|
fffhghgjh
一般會員 發表:2 回覆:33 積分:17 註冊:2004-12-23 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |