lingming1120 發表於 2019-9-28 20:31:00

BCB 作業問題

void __fastcall TForm1::Button3Click(TObject *Sender)
{
        int rep = StrToInt(Edit4->Text);
        int step = StrToInt(Edit5->Text);
        Chart1->RemoveAllSeries();
        Chart1->Title->Text->Clear();
        Chart1->Title->Text->Add("Sorting Alg");
        Chart1->BottomAxis->Title->Caption = "Data";
        Chart1->LeftAxis->Title->Caption = "CPU Time *10";
        data_num = StrToInt(Edit1->Text);
        for ( int i = 1 ; i < rep ; i ++ )
                data_num = data_num + i*step ;
        for ( int i = 0 ; i < rep  ; i ++ )
        {
                Memo1 -> Lines -> Add("||Repeat = " + IntToStr(i+1)+"||");
                Generation->Click();
                Memo2 -> Lines -> Add("||Repeat = " + IntToStr(i+1)+"||");
                Selection->Click();
                Memo3 -> Lines -> Add("||Repeat = " + IntToStr(i+1)+"||");
                Bubble->Click();
                Memo4 -> Lines -> Add("||Repeat = " + IntToStr(i+1)+"||");
                Binary->Click();
                //Edit1->Text=IntToStr(n+step);
                repeat ++;

        }

        for (int i=0;i<2;i++)
        {
                TLineSeries *Series=new TLineSeries(Chart1);
                Series->ParentChart=Chart1;
                Chart1->AddSeries(Series);
        }
        for (int i=0; i<rep; i++)
        {
                Chart1->Series->Title =  "Selection Sort";
                Chart1->Series->Title =  "Bubble Sort";
                Chart1->Series->Add( SelSortTime , data_num , clBlue );
                Chart1->Series->Add( BubSortTime , data_num , clRed );
        }
}

控制所有按鍵 再次點擊 值全部變為0 有誰能幫我解答嗎 感恩
頁: [1]
查看完整版本: BCB 作業問題