請大家教我如何撰寫電子錢包的介面 |
缺席
|
m9452
一般會員 發表:2 回覆:2 積分:0 註冊:2008-05-30 發送簡訊給我 |
|
m9452
一般會員 發表:2 回覆:2 積分:0 註冊:2008-05-30 發送簡訊給我 |
#include <vcl.h>
#pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { int Money=10000; Edit1->Text = Money; } //--------------------------------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender) { lblout->Caption =StrToInt(Edit1->Text) StrToInt(Edit2->Text); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button3Click(TObject *Sender) { lblout->Caption=StrToInt (Edit1->Text) - StrToInt(Edit2->Text); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button4Click(TObject *Sender) { Close(); } 電子錢包的程式我已做出雛型以上是我自己寫的~~~但還差一下功能就是<扣款><儲值>將餘額回存目前金額那方面有點卡關~~還有一項功能就是餘額小於0時要出現金額不足~~~希望有高手可指點迷津一下感謝 |
bybreak
一般會員 發表:5 回覆:10 積分:8 註冊:2008-05-23 發送簡訊給我 |
卡關是卡在沒有累加(減)功能嗎?
是的話加法可以改成這樣: Money = Money StrToInt(Edit2->Text); lblout->Caption=Money; 金額小於0的地方用if判斷Money應該就可以了吧 ===================引 用 m9452 文 章=================== #include #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { int Money=10000; Edit1->Text = Money; } //--------------------------------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender) { lblout->Caption =StrToInt(Edit1->Text) StrToInt(Edit2->Text); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button3Click(TObject *Sender) { lblout->Caption=StrToInt (Edit1->Text) - StrToInt(Edit2->Text); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button4Click(TObject *Sender) { Close(); } 電子錢包的程式我已做出雛型以上是我自己寫的~~~但還差一下功能就是<扣款><儲值>將餘額回存目前金額那方面有點卡關~~還有一項功能就是餘額小於0時要出現金額不足~~~希望有高手可指點迷津一下感謝
編輯記錄
bybreak 重新編輯於 2008-06-03 09:28:31, 註解 無‧
|
friendshipqoo
一般會員 發表:4 回覆:7 積分:7 註冊:2007-03-23 發送簡訊給我 |
不知道否可以請教一下
lblout<==這是什麼呢?元件嗎?若是是在哪裡呢? ===================引 用 m9452 文 章=================== #include #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { int Money=10000; Edit1->Text = Money; } //--------------------------------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender) { lblout->Caption =StrToInt(Edit1->Text) StrToInt(Edit2->Text); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button3Click(TObject *Sender) { lblout->Caption=StrToInt (Edit1->Text) - StrToInt(Edit2->Text); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button4Click(TObject *Sender) { Close(); } 電子錢包的程式我已做出雛型以上是我自己寫的~~~但還差一下功能就是<扣款><儲值>將餘額回存目前金額那方面有點卡關~~還有一項功能就是餘額小於0時要出現金額不足~~~希望有高手可指點迷津一下感謝
------
芋頭~~~ |
m9452
一般會員 發表:2 回覆:2 積分:0 註冊:2008-05-30 發送簡訊給我 |
謝謝大家的幫忙,我已完成電子錢包的介面以下是我的完整程式~~~假如大家有同樣的問題很歡迎大家來交換心得
#include #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { int Money=10000; Edit1->Text = Money; } //--------------------------------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender) { if (StrToInt (Edit1->Text) >=30000 ) ShowMessage("最高額度限度"); else { Edit1->Text =IntToStr(StrToInt(Edit1->Text) StrToInt(Edit2->Text)); lblout->Caption = Edit1->Text; } } //--------------------------------------------------------------------------- void __fastcall TForm1::Button3Click(TObject *Sender) { if (StrToInt (Edit1->Text) < StrToInt(Edit2->Text)) ShowMessage("金額不足"); else { if (StrToInt (Edit1->Text) <=1000) ShowMessage("金額低於1000請儲值"); Edit1->Text = IntToStr(StrToInt (Edit1->Text) - StrToInt(Edit2->Text)); lblout->Caption=Edit1->Text; } } //--------------------------------------------------------------------------- void __fastcall TForm1::Button4Click(TObject *Sender) { Close(); } 芋頭~~~~~lblout這是物件的名稱這是我自己改的名稱可讓我寫程式方便知道它是輸出的名稱 lblout~~~它的原名Label1~~~~~~書上都有你可以去看看~~~希望我的回答你能滿意 有問題可以一起討論或交換心得~~~我其實也是個新手~~~自己看書學習 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |