11. december 2000 - 18:32
Der er
20 kommentarer og 1 løsning
Funktioner i C++ Builder
Jeg har en del koder i mit program som jeg skal genbruger, derfor vil det jo være smart at skrive det som en funktion! også bare kalde den! jeg skal både lave funktioner der retunere en værdi og funktioner der ikke retunere en værdi... problemmet er bare... jeg ik\' ve\' hvordan man laver funktioner i C++ Builder! Derfor hvordan laver man en funktion i C++ Builer?
Annonceindlæg fra DE-CIX
Edge computing: behandling ved kilden
Edge computing revolutionerer den måde, data behandles på, ved at bringe kapacitet og ydeevne tættere på dér, hvor der er behov for det.
15. april 2025
jd
Nybegynder
11. december 2000 - 21:29
#1
function noget(){ udfør handlinger } bare et gæt :)
11. december 2000 - 21:46
#2
du har muligvis ret.... men hvor skal den stå (oprettes).......
jd
Nybegynder
11. december 2000 - 21:59
#3
ehm ? Et sted i koden, sikkert lige efter dine #include\'s
11. december 2000 - 22:08
#4
jeg har skrevet functionen lige efter min #include\'s function newgame() { Min kode } det giver en fejl! [C++ Error] Unit1.cpp(31): E2141 Declaration syntax error.
11. december 2000 - 22:13
#5
et det i en form unit? Husk du også at skrive i headerfilen? void function newgame();
11. december 2000 - 22:20
#6
Jeg har prøvet at skrive den ind i headerfilen skriver jeg: function newgame() { Min kode } giver det en fejl! [C++ Error] Unit1.h(12): E2141 Declaration syntax error. skriver jeg: void function newgame(); { Min kode } det giver fejl! [C++ Error] Unit1.h(12): E2449 Size of \'function\' is unknown or zero. [C++ Error] Unit1.h(12): E2141 Declaration syntax error. [C++ Error] Unit1.h(13): E2040 Declaration terminated incorrectly. (bægge to i headfilen)
11. december 2000 - 22:22
#7
du skal skrive void function newgame() { Min kode } i cpp filen, og void function newgame(); i h filen!
11. december 2000 - 22:27
#8
Det giver de her fejl: [C++ Error] Unit1.h(12): E2449 Size of \'function\' is unknown or zero. [C++ Error] Unit1.h(12): E2141 Declaration syntax error. [C++ Error] Unit1.cpp(31): E2449 Size of \'function\' is unknown or zero. [C++ Error] Unit1.cpp(31): E2238 Multiple declaration for \'function\'. [C++ Error] Unit1.h(12): E2344 Earlier declaration of \'function\'. [C++ Error] Unit1.cpp(31): E2141 Declaration syntax error.
11. december 2000 - 22:30
#9
lidt pinligt, det burde jeg hav set med det samme! Du skriver ikke function i c++: void newgame() { Min kode } i cpp filen, og void newgame(); i h filen!
11. december 2000 - 22:34
#10
Jo... Det er C++ skriver jeg ik\' function.... kommer der en fejl for hver line kode!
11. december 2000 - 22:37
#11
du skriver ikke function, desuden skal du gøre den en del af din unit-> i cpp filen skirver du: void TForm1::newgame() { Min kode }
11. december 2000 - 22:49
#12
hvis der står void TForm1::newgame() { Min kode } i cpp filen void function newgame(); i h filen giver det de her fejl: [C++ Error] Unit1.h(145): E2449 Size of \'function\' is unknown or zero. [C++ Error] Unit1.h(145): E2139 Declaration missing ;. [C++ Error] Unit1.h(147): E2321 Declaration does not specify a tag or an identifier. [C++ Error] Unit1.cpp(32): E2316 \'TForm1::newgame()\' is not a member of \'TForm1\'. ---------------- Skriver jeg void TForm1::newgame() i h filen giver det de her fejl: [C++ Error] Unit1.h(145): E2238 Multiple declaration for \'TForm1::newgame\'. [C++ Error] Unit1.h(134): E2344 Earlier declaration of \'TForm1::newgame\'. [C++ Error] Unit1.cpp(32): E2316 \'TForm1::newgame()\' is not a member of \'TForm1\'.
11. december 2000 - 22:52
#13
du må poste hele koden! båse h og cpp filen!
11. december 2000 - 22:52
#14
du må poste hele koden! båse h og cpp filen!
11. december 2000 - 22:55
#15
Det er mit første progam... derfor de skod koder... h filen //--------------------------------------------------------------------------- #ifndef Unit1H #define Unit1H //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <Menus.hpp> //--------------------------------------------------------------------------- class TForm1 : public TForm { __published: // IDE-managed Components TGroupBox *GroupBox1; TLabel *name1; TLabel *name2; TLabel *name3; TGroupBox *GroupBox3; TLabel *spiller1toere; TLabel *spiller2toere; TLabel *spiller3toere; TGroupBox *GroupBox4; TLabel *spiller1treere; TLabel *spiller2treere; TLabel *spiller3treere; TGroupBox *GroupBox5; TLabel *spiller1fireere; TLabel *spiller2fireere; TLabel *spiller3fireere; TGroupBox *GroupBox6; TLabel *spiller1femere; TLabel *spiller2femere; TLabel *spiller3femere; TGroupBox *GroupBox7; TLabel *spiller1seksere; TLabel *spiller2seksere; TLabel *spiller3seksere; TGroupBox *GroupBox8; TLabel *spiller1sum; TLabel *spiller2sum; TLabel *spiller3sum; TGroupBox *GroupBox9; TLabel *spiller1bonus; TLabel *spiller2bonus; TLabel *spiller3bonus; TGroupBox *GroupBox10; TLabel *spiller1etpar; TLabel *spiller2etpar; TLabel *spiller3etpar; TGroupBox *GroupBox11; TLabel *spiller1topar; TLabel *spiller2topar; TLabel *spiller3topar; TGroupBox *GroupBox12; TLabel *spiller1trelige; TLabel *spiller2trelige; TLabel *spiller3trelige; TGroupBox *GroupBox13; TLabel *spiller1firelige; TLabel *spiller2firelige; TLabel *spiller3firelige; TGroupBox *lillestraight; TLabel *spiller1lillestraight; TLabel *spiller2lillestraight; TLabel *spiller3lillestraight; TGroupBox *GroupBox15; TLabel *spiller1storstraight; TLabel *spiller2storstraight; TLabel *spiller3storstraight; TGroupBox *GroupBox16; TLabel *spiller1hus; TLabel *spiller2hus; TLabel *spiller3hus; TGroupBox *GroupBox17; TLabel *spiller1chance; TLabel *spiller2chance; TLabel *spiller3chance; TGroupBox *GroupBox18; TLabel *spiller1yatzy; TLabel *spiller2yatzy; TLabel *spiller3yatzy; TGroupBox *GroupBox19; TLabel *spiller1total; TLabel *spiller2total; TLabel *spiller3total; TMainMenu *MainMenu1; TMenuItem *File1; TMenuItem *Options1; TMenuItem *Help1; TMenuItem *NewGame1; TMenuItem *Exit1; TMenuItem *About1; TMenuItem *AntalSpillere1; TGroupBox *GroupBox20; TLabel *Label59; TLabel *Label60; TLabel *Label61; TGroupBox *GroupENere; TLabel *spiller1enere; TLabel *spiller2enere; TLabel *spiller3enere; TGroupBox *Terningerne; TEdit *Terning2; TEdit *Terning3; TEdit *Terning4; TEdit *Terning1; TLabel *Label58; TCheckBox *CheckBox1; TCheckBox *CheckBox2; TCheckBox *CheckBox3; TCheckBox *CheckBox4; TCheckBox *CheckBox5; TEdit *Terning5; TButton *Terning; TGroupBox *valgbox; TRadioButton *radioenere; TRadioButton *radiotoere; TRadioButton *radiotreere; TRadioButton *radiofireere; TRadioButton *radiofemere; TRadioButton *radioseksere; TRadioButton *radioetpar; TRadioButton *radiotopar; TRadioButton *radiotrelige; TRadioButton *radiofirelige; TRadioButton *radiolillestraight; TRadioButton *radiostorstraight; TRadioButton *radiohus; TRadioButton *radiochance; TRadioButton *radioyatzy; TButton *Button; TButton *newgame; void __fastcall Exit1Click(TObject *Sender); void __fastcall TerningClick(TObject *Sender); void __fastcall NewGame1Click(TObject *Sender); void __fastcall About1Click(TObject *Sender); void __fastcall newgameClick(TObject *Sender); void __fastcall ButtonClick(TObject *Sender); private: // User declarations public: // User declarations __fastcall TForm1(TComponent* Owner); void function newgame(); }; //--------------------------------------------------------------------------- extern PACKAGE TForm1 *Form1; //--------------------------------------------------------------------------- #endif cpp filen: //--------------------------------------------------------------------------- #include <vcl.h> #include <stdlib.h> #include <time.h> #pragma hdrstop #include \"Unit1.h\" #include \"Unit2.h\" #include \"Unit3.h\" #include \"Unit4.h\" #include \"Unit5.h\" #include \"Unit6.h\" #include \"Unit7.h\" #include \"Unit8.h\" #include \"Unit9.h\" #include \"Unit10.h\" #include \"Unit11.h\" int spiller, tur; int tal1, tal2, tal3, tal4, tal5, sum1, sum2, sum3, bonus1, bonus2, bonus3; int enere1, toere1, treere1, fireere1, femere1, seksere1; int enere2, toere2, treere2, fireere2, femere2, seksere2; int enere3, toere3, treere3, fireere3, femere3, seksere3; int etpar1, etpar2, etpar3, topar1, topar2, topar3; int trelige1, trelige2, trelige3, firelige1, firelige2, firelige3; int lille1, lille2, lille3, stor1, stor2, stor3; int hus1, hus2, hus3, chance1, chance2, chance3; int yatzy1, yatzy2, yatzy3, total1, total2, total3; void TForm1::newgame() { newgame->Visible = false; valgbox->Visible = true; Terningerne->Visible = true; spiller = 1; tur = 0; CheckBox1->Checked = false; CheckBox2->Checked = false; CheckBox3->Checked = false; CheckBox4->Checked = false; CheckBox5->Checked = false; enere1 = 0; toere1 = 0; treere1 = 0; fireere1 = 0; femere1 = 0; seksere1 = 0; spiller1enere->Caption = enere1; spiller1toere->Caption = toere1; spiller1treere->Caption = treere1; spiller1fireere->Caption = fireere1; spiller1femere->Caption = femere1; spiller1seksere->Caption = seksere1; enere2 = 0; toere2 = 0; treere2 = 0; fireere2 = 0; femere2 = 0; seksere2 = 0; spiller2enere->Caption = enere2; spiller2toere->Caption = toere2; spiller2treere->Caption = treere2; spiller2fireere->Caption = fireere2; spiller2femere->Caption = femere2; spiller2seksere->Caption = seksere2; enere3 = 0; toere3 = 0; treere3 = 0; fireere3 = 0; femere3 = 0; seksere3 = 0; spiller3enere->Caption = enere3; spiller3toere->Caption = toere3; spiller3treere->Caption = treere3; spiller3fireere->Caption = fireere3; spiller3femere->Caption = femere3; spiller3seksere->Caption = seksere3; sum1 = 1; sum2 = 1; sum3 = 1; spiller1sum->Caption = sum1; spiller2sum->Caption = sum2; spiller3sum->Caption = sum3; bonus1 = 0; bonus2 = 0; bonus3 = 0; spiller1bonus->Caption = bonus1; spiller2bonus->Caption = bonus2; spiller3bonus->Caption = bonus3; etpar1 = 0; etpar2 = 0; etpar3 = 0; spiller1etpar->Caption = etpar1; spiller2etpar->Caption = etpar2; spiller3etpar->Caption = etpar3; topar1 = 0; topar2 = 0; topar3 = 0; spiller1topar->Caption = topar1; spiller2topar->Caption = topar2; spiller3topar->Caption = topar3; trelige1 = 0; trelige2 = 0; trelige3 = 0; spiller1trelige->Caption = trelige1; spiller2trelige->Caption = trelige2; spiller3trelige->Caption = trelige3; firelige1 = 0; firelige1 = 0; firelige1 = 0; spiller1firelige->Caption = firelige1; spiller2firelige->Caption = firelige2; spiller3firelige->Caption = firelige3; lille1 = 0; lille2 = 0; lille3 = 0; spiller1lillestraight->Caption = lille1; spiller2lillestraight->Caption = lille2; spiller3lillestraight->Caption = lille3; stor1 = 0; stor2 = 0; stor3 = 0; spiller1storstraight->Caption = stor1; spiller2storstraight->Caption = stor2; spiller3storstraight->Caption = stor3; hus1 = 0; hus2 = 0; hus3 = 0; spiller1hus->Caption = hus1; spiller2hus->Caption = hus2; spiller3hus->Caption = hus3; chance1 = 0; chance2 = 0; chance3 = 0; spiller1chance->Caption = chance1; spiller2chance->Caption = chance2; spiller3chance->Caption = chance3; yatzy1 = 0; yatzy2 = 0; yatzy3 = 0; spiller1yatzy->Caption = yatzy1; spiller2yatzy->Caption = yatzy2; spiller3yatzy->Caption = yatzy3; total1 = 0; total2 = 0; total3 = 0; spiller1total->Caption = total1; spiller2total->Caption = total2; spiller3total->Caption = total3; }; //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource \"*.dfm\" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Exit1Click(TObject *Sender) { Close(); } //--------------------------------------------------------------------------- void __fastcall TForm1::TerningClick(TObject *Sender) { // Tester hvilken spillers tur det er. (hver spiller må kaste 3 gange) // unchecker gem boksen if(tur > 3) { CheckBox1->Checked = false; CheckBox2->Checked = false; CheckBox3->Checked = false; CheckBox4->Checked = false; CheckBox5->Checked = false; spiller++; tur = 0; } if(spiller == 4) { spiller = 1; } // generar 6 tilfældige tal (Kaster terningerne) randomize; if(CheckBox1->Checked == false) { tal1 = random(6); tal1++; Terning1->Text = tal1; } if(CheckBox2->Checked == false) { tal2 = random(6); tal2++; Terning2->Text = tal2; } if(CheckBox3->Checked == false) { tal3 = random(6); tal3++; Terning3->Text = tal3; } if(CheckBox4->Checked == false) { tal4 = random(6); tal4++; Terning4->Text = tal4; } if(CheckBox5->Checked == false) { tal5 = random(6); tal5++; Terning5->Text = tal5; } // Ligger spillernes point sammen (både de seks første og total) // Tjekker om spilleren skal havde bonus (63 point i de 6 første felter switch(spiller) { //spiller 1 case 1: { tur++; sum1 = enere1 + toere1 + treere1 + fireere1 + femere1 +seksere1; spiller1sum->Caption = sum1; total1 = sum1 + etpar1 + topar1 + trelige1 + firelige1 + lille1 + stor1 + hus1 + chance1 + yatzy1; spiller1total->Caption = total1; if(sum1 > 63) { bonus1 = 50; spiller1bonus->Caption = bonus1; } if(sum1 < 63) { bonus1 = 0; spiller1bonus->Caption = bonus1; } if(tur == 3) { spiller = 2; tur = 0; } break; } //spiller 2 case 2: { tur++; sum2 = enere2 + toere2 + treere2 + fireere2 + femere2 +seksere2; spiller2sum->Caption = sum2; total2 = sum2 + etpar2 + topar2 + trelige2 + firelige2 + lille2 + stor2 + hus2 + chance2 + yatzy2; spiller2total->Caption = total2; if(sum2 > 63) { bonus2 = 50; spiller2bonus->Caption = bonus2; } if(sum2 < 63) { bonus2 = 0; spiller2bonus->Caption = bonus2; } if(tur == 3) { spiller = 3; tur = 0; } break; } //spiller 3 case 3: { tur++; sum3 = enere3 + toere3 + treere3 + fireere3 + femere3 +seksere3; spiller3sum->Caption = sum3; total3 = sum3 + etpar3 + topar3 + trelige3 + firelige3 + lille3 + stor3 + hus3 + chance3 + yatzy3; spiller3total->Caption = total3; if(sum3 > 63) { bonus3 = 50; spiller3bonus->Caption = bonus2; } if(sum3 < 63) { bonus3 = 0; spiller3bonus->Caption = bonus2; } if(tur == 3) { spiller = 1; tur = 0; } break; } default: spiller = 0; break; } } //--------------------------------------------------------------------------- void __fastcall TForm1::NewGame1Click(TObject *Sender) { newgame(); } //------------------------------------------------------------------------------ void __fastcall TForm1::About1Click(TObject *Sender) { About->Show(); } //--------------------------------------------------------------------------- void __fastcall TForm1::newgameClick(TObject *Sender) { newgame->Visible = false; valgbox->Visible = true; Terningerne->Visible = true; spiller = 1; tur = 0; CheckBox1->Checked = false; CheckBox2->Checked = false; CheckBox3->Checked = false; CheckBox4->Checked = false; CheckBox5->Checked = false; enere1 = 0; toere1 = 0; treere1 = 0; fireere1 = 0; femere1 = 0; seksere1 = 0; spiller1enere->Caption = enere1; spiller1toere->Caption = toere1; spiller1treere->Caption = treere1; spiller1fireere->Caption = fireere1; spiller1femere->Caption = femere1; spiller1seksere->Caption = seksere1; enere2 = 0; toere2 = 0; treere2 = 0; fireere2 = 0; femere2 = 0; seksere2 = 0; spiller2enere->Caption = enere2; spiller2toere->Caption = toere2; spiller2treere->Caption = treere2; spiller2fireere->Caption = fireere2; spiller2femere->Caption = femere2; spiller2seksere->Caption = seksere2; enere3 = 0; toere3 = 0; treere3 = 0; fireere3 = 0; femere3 = 0; seksere3 = 0; spiller3enere->Caption = enere3; spiller3toere->Caption = toere3; spiller3treere->Caption = treere3; spiller3fireere->Caption = fireere3; spiller3femere->Caption = femere3; spiller3seksere->Caption = seksere3; sum1 = 1; sum2 = 1; sum3 = 1; spiller1sum->Caption = sum1; spiller2sum->Caption = sum2; spiller3sum->Caption = sum3; bonus1 = 0; bonus2 = 0; bonus3 = 0; spiller1bonus->Caption = bonus1; spiller2bonus->Caption = bonus2; spiller3bonus->Caption = bonus3; etpar1 = 0; etpar2 = 0; etpar3 = 0; spiller1etpar->Caption = etpar1; spiller2etpar->Caption = etpar2; spiller3etpar->Caption = etpar3; topar1 = 0; topar2 = 0; topar3 = 0; spiller1topar->Caption = topar1; spiller2topar->Caption = topar2; spiller3topar->Caption = topar3; trelige1 = 0; trelige2 = 0; trelige3 = 0; spiller1trelige->Caption = trelige1; spiller2trelige->Caption = trelige2; spiller3trelige->Caption = trelige3; firelige1 = 0; firelige1 = 0; firelige1 = 0; spiller1firelige->Caption = firelige1; spiller2firelige->Caption = firelige2; spiller3firelige->Caption = firelige3; lille1 = 0; lille2 = 0; lille3 = 0; spiller1lillestraight->Caption = lille1; spiller2lillestraight->Caption = lille2; spiller3lillestraight->Caption = lille3; stor1 = 0; stor2 = 0; stor3 = 0; spiller1storstraight->Caption = stor1; spiller2storstraight->Caption = stor2; spiller3storstraight->Caption = stor3; hus1 = 0; hus2 = 0; hus3 = 0; spiller1hus->Caption = hus1; spiller2hus->Caption = hus2; spiller3hus->Caption = hus3; chance1 = 0; chance2 = 0; chance3 = 0; spiller1chance->Caption = chance1; spiller2chance->Caption = chance2; spiller3chance->Caption = chance3; yatzy1 = 0; yatzy2 = 0; yatzy3 = 0; spiller1yatzy->Caption = yatzy1; spiller2yatzy->Caption = yatzy2; spiller3yatzy->Caption = yatzy3; total1 = 0; total2 = 0; total3 = 0; spiller1total->Caption = total1; spiller2total->Caption = total2; spiller3total->Caption = total3; } //--------------------------------------------------------------------------- void __fastcall TForm1::ButtonClick(TObject *Sender) { if(radioenere->Checked == true) { switch(spiller) { case 1: { if(tal1 == 1) { enere1++; } if(tal2 == 1) { enere1++; } if(tal3 == 1) { enere1++; } if(tal4 == 1) { enere1++; } if(tal5 == 1) { enere1++; } spiller1enere->Caption = enere1; break; } case 2: { if(tal1 == 1) { enere2++; } if(tal2 == 1) { enere2++; } if(tal3 == 1) { enere2++; } if(tal4 == 1) { enere2++; } if(tal5 == 1) { enere2++; } spiller2enere->Caption = enere1; break; } case 3: { if(tal1 == 1) { enere3++; } if(tal2 == 1) { enere3++; } if(tal3 == 1) { enere3++; } if(tal4 == 1) { enere3++; } if(tal5 == 1) { enere3++; } spiller3enere->Caption = enere1; break; } default: { break; } } tur = 3; } if(radiotoere->Checked == true) { switch(spiller) { case 1: { if(tal1 == 2) { toere1 = toere1 + 2; } if(tal2 == 2) { toere1 = toere1 + 2; } if(tal3 == 2) { toere1 = toere1 + 2; } if(tal4 == 2) { toere1 = toere1 + 2; } if(tal5 == 2) { toere1 = toere1 + 2; } spiller1toere->Caption = enere1; break; } case 2: { if(tal1 == 2) { toere2 = toere2 + 2; } if(tal2 == 2) { toere2 = toere2 + 2; } if(tal3 == 2) { toere2 = toere2 + 2; } if(tal4 == 2) { toere2 = toere2 + 2; } if(tal5 == 2) { toere2 = toere2 + 2; } spiller2toere->Caption = enere2; break; } case 3: { if(tal1 == 2) { toere3 = toere3 + 2; } if(tal2 == 2) { toere3 = toere3 + 2; } if(tal3 == 2) { toere3 = toere3 + 2; } if(tal4 == 2) { toere3 = toere3 + 2; } if(tal5 == 2) { toere3 = toere3 + 2; } spiller3toere->Caption = enere3; break; } } tur = 3; } if(radiotreere->Checked == true) { switch(spiller) { case 1: { if(tal1 == 3) { treere1 = treere1 + 3; } if(tal2 == 3) { treere1 = treere1 + 3; } if(tal3 == 3) { treere1 = treere1 + 3; } if(tal4 == 3) { treere1 = treere1 + 3; } if(tal5 == 3) { treere1 = treere1 + 3; } spiller1treere->Caption = treere1; break; } case 2: { if(tal1 == 3) { treere2 = treere2 + 3; } if(tal2 == 3) { treere2 = treere2 + 3; } if(tal3 == 3) { treere2 = treere2 + 3; } if(tal4 == 3) { treere2 = treere2 + 3; } if(tal5 == 3) { treere2 = treere2 + 3; } spiller2treere->Caption = treere2; break; } case 3: { if(tal1 == 3) { treere3 = treere3 + 3; } if(tal2 == 3) { treere3 = treere3 + 3; } if(tal3 == 3) { treere3 = treere3 + 3; } if(tal4 == 3) { treere3 = treere3 + 3; } if(tal5 == 3) { treere3 = treere3 + 3; } spiller3treere->Caption = treere3; break; } } tur = 3; } if(radiofireere->Checked == true) { switch(spiller) { case 1: { if(tal1 == 4) { fireere1 = fireere1 + 4; } if(tal1 == 4) { fireere1 = fireere1 + 4; } if(tal2 == 4) { fireere1 = fireere1 + 4; } if(tal3 == 4) { fireere1 = fireere1 + 4; } if(tal4 == 4) { fireere1 = fireere1 + 4; } if(tal5 == 4) { fireere1 = fireere1 + 4; } spiller1fireere->Caption = fireere1; break; } case 2: { if(tal1 == 4) { fireere2 = fireere2 + 4; } if(tal1 == 4) { fireere2 = fireere2 + 4; } if(tal2 == 4) { fireere2 = fireere2 + 4; } if(tal3 == 4) { fireere2 = fireere2 + 4; } if(tal4 == 4) { fireere2 = fireere2 + 4; } if(tal5 == 4) { fireere2 = fireere2 + 4; } spiller2fireere->Caption = fireere2; break; } case 3: { if(tal1 == 4) { fireere3 = fireere3 + 4; } if(tal1 == 4) { fireere3 = fireere3 + 4; } if(tal2 == 4) { fireere3 = fireere3 + 4; } if(tal3 == 4) { fireere3 = fireere3 + 4; } if(tal4 == 4) { fireere3 = fireere3 + 4; } if(tal5 == 4) { fireere3 = fireere3 + 4; } spiller3fireere->Caption = fireere3; break; } } tur = 3; } if(radiofemere->Checked == true) { switch(spiller) { case 1: { if(tal1 == 5) { femere1 = femere1 + 5; } if(tal2 == 5) { femere1 = femere1 + 5; } if(tal3 == 5) { femere1 = femere1 + 5; } if(tal4 == 5) { femere1 = femere1 + 5; } if(tal5 == 5) { femere1 = femere1 + 5; } spiller1femere->Caption = femere1; break; } case 2: { if(tal1 == 5) { femere2 = femere2 + 5; } if(tal2 == 5) { femere2 = femere2 + 5; } if(tal3 == 5) { femere2 = femere2 + 5; } if(tal4 == 5) { femere2 = femere2 + 5; } if(tal5 == 5) { femere2 = femere2 + 5; } spiller2femere->Caption = femere2; break; } case 3: { if(tal1 == 5) { femere3 = femere3 + 5; } if(tal2 == 5) { femere3 = femere3 + 5; } if(tal3 == 5) { femere3 = femere3 + 5; } if(tal4 == 5) { femere3 = femere3 + 5; } if(tal5 == 5) { femere3 = femere3 + 5; } spiller3femere->Caption = femere3; break; } } tur = 3; } if(radioseksere->Checked == true) { switch(spiller) { case 1: { if(tal1 == 6) { seksere1 = seksere1 + 6; } if(tal2 == 6) { seksere1 = seksere1 + 6; } if(tal3 == 6) { seksere1 = seksere1 + 6; } if(tal4 == 6) { seksere1 = seksere1 + 6; } if(tal5 == 6) { seksere1 = seksere1 + 6; } spiller1seksere->Caption = seksere1; break; } case 2: { if(tal1 == 6) { seksere2 = seksere2 + 6; } if(tal2 == 6) { seksere2 = seksere2 + 6; } if(tal3 == 6) { seksere2 = seksere2 + 6; } if(tal4 == 6) { seksere2 = seksere2 + 6; } if(tal5 == 6) { seksere2 = seksere2 + 6; } spiller2seksere->Caption = seksere2; break; } case 3: { if(tal1 == 6) { seksere3 = seksere3 + 6; } if(tal2 == 6) { seksere3 = seksere3 + 6; } if(tal3 == 6) { seksere3 = seksere3 + 6; } if(tal4 == 6) { seksere3 = seksere3 + 6; } if(tal5 == 6) { seksere3 = seksere3 + 6; } spiller3seksere->Caption = seksere3; break; } } tur = 3; } if(radioetpar->Checked == true) { Form3->Show(); } if(radiotopar->Checked == true) { Form4->Show(); } if(radiotrelige->Checked == true) { Form5->Show(); } if(radiofirelige->Checked == true) { Form6->Show(); } if(radiolillestraight->Checked == true) { Form7->Show(); } if(radiostorstraight->Checked == true) { Form8->Show(); } if(radiohus->Checked == true) { Form9->Show(); } if(radiochance->Checked == true) { Form10->Show(); } if(radioyatzy->Checked == true) { Form11->Show(); } } //---------------------------------------------------------------------------
11. december 2000 - 22:56
#16
det mest skal laves om til functioner....
11. december 2000 - 22:59
#17
du har en knap der hedder newgame. De må ikke hedde det samme! Og du må stadigvæk ikke skrive \"function\" i h-filen eller cpp-filen!
11. december 2000 - 23:04
#18
Nu for jeg den her fejl: [C++ Error] Unit1.cpp(34): E2288 Pointer to structure required on left side of -> or ->*.
11. december 2000 - 23:18
#19
Det virker nu ;-)
11. december 2000 - 23:19
#20
Den sidste fejl var pågrund af jeg jo omdøbte en knap...
11. december 2000 - 23:22
#21
TAK
Kurser inden for grundlæggende programmering