Washing a C ++ class!

zhaozj2021-02-16  52

This is a buffet! A few simple excuses! BOOL __FASTCALL Refresh (); Wrunage INT __FASTCALL GETBYINDEX (INT _INDEX); Book according to sequential parameters; Grefresh_card (int _CardNum = 54); initialization, _cardnum is the number of sheets, default 54; void free (); Used to release some necessary things; ansistring getusefully (int _index); true cardboard, colored! Code as follows:

/ / -------------------------------------------------------------------------------------------- ---------------------------

#pragma HDRSTOP

#include "refc.h" #include #include #include #include // ----------------- -------------------------------------------------- ------------

#pragma package (smart_init) Grefresh_card :: ~ Grefresh_card () {// ¹¹ free ();

}

BOOL __FASTCALL GREFRESH_CARD :: Refresh () {// ï'åæ bool card_result = false; srand ((unsigned) Time (null)); // ô¼¼õõõ »ðð £ ¬¬ªæ ± × × ÷ ªªªæ» úêýööö × ó std: : random_shuffle (card-> begin (), card-> end (); return card_result;}

INT __FASTCALL GREFRESH_CARD :: GetByindex (int _index) {// äçåæ £ »Return (_index> = 0 && _INDEX Operator [] (_ index): 0;

}

GREFRESH_CARD :: Grefresh_Card (int _cardnum) {// 3õõõ4 »¯ £» CARD_NUM = _CardNum; card = new std :: vector ; for (int = 0; i <54; i ) card-> push_back (i ); Card_color = new tstringlist (); card_color-> add ("1/2 éé"); card_color-> add ("» ¨ "); card_color-> add (" oììò "); card_color-> add ( "Oúìò");

Void Grefresh_Card :: free () {delete card; card = null; delete card_color; card_color = null;

AnsiString GRefresh_Card :: Getusefully (int _index) {int _color = Getbyindex (_index)% 13; int _value = Getbyindex (_index) / 13; if (_value> 3) {AnsiString result; _color result = "'óÍõ":? Result = "С õõ"; returnrate;} else {ANSISTRING Result = card_color-> operator [] (_ value) INTOSTR (_COLOR 1); return fruit;}} // ---------- -------------------------------------------------- ---------------

#ifndef refch # deflish refch # include #include // -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------- Class Grefresh_card {protected: int Card_Num; std :: vector * Card; TStringList * Card_color; public: ~ GRefresh_Card (); bool __fastcall Refresh (); int __fastcall getbyindex (int _index); GRefresh_Card (int _CardNum = 54); void free () Ansistring getUsefully (int _index);}; # ENDIF

转载请注明原文地址:https://www.9cbs.com/read-22680.html

New Post(0)