Hazır Program

Anasayfa Programlama C++ Builder Lig (Puan Durumu)


Lig (Puan Durumu)

E-posta Yazdır

AÇIKLAMA

C++ Builder 2009  projesidir.

Öncelikli olarak Takım Gir kısmından lige kaç adet takım girilecekse eklenmelidir.Takım ekleme işlemi bittikten sonra eklenmiş listeden bir takım seçilip Skor Gir butonuna tıklanır. İki takım arasındaki maçın skoru girilir. Buna istinaden oluşan puan durumu anında yansıtılır.

Programın Tamamını Aşağıdaki Linkten İndirebilirsiniz

Program Kodu:

Unit1.cpp

//---------------------------------------------------------------------------
 
#include <vcl.h>
#pragma hdrstop
 
#include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int kontrol=0;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(Edit1->Text!="")
{
ListBox1->Items->Add(Edit1->Text);
Edit1->Text="";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
 
if(kontrol==0)
{
for(int i=0;i<ListBox1->Items->Count;i++)
{
ListBox2->Items->Add("0");
ListBox3->Items->Add("0");
}
kontrol=1;
}
int x=ListBox1->ItemIndex;
if(x<0)
Application->MessageBox(L"1.Takımı Seçiniz",L"UYARI",MB_ICONINFORMATION) ;
else
{
 Form2->ListBox1->Items->Clear();
 Form2->Show();
 for(int p=0;p<ListBox1->Items->Count;p++)
 {
 if(p!=x)
 Form2->ListBox1->Items->Add(ListBox1->Items->Strings[p]);
 }
 Label1->Visible=false;
Edit1->Visible=false;
Button1->Visible=false;
}
}
 
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit1KeyPress(TObject *Sender, wchar_t &Key)
{
if(Key==L'Ğ' || Key==L'ğ')
Key=L'Ğ';
else if(Key==L'Ü' || Key==L'ü')
Key=L'Ü';
else if(Key==L'Ş' || Key==L'ş')
Key=L'Ş';
else if(Key==L'İ' || Key==L'i')
Key=L'İ';
else if(Key==L'Ö' || Key==L'ö')
Key=L'Ö';
else if(Key==L'Ş' || Key==L'Ş')
Key=L'Ş';
else if(Key==L'Ç' || Key==L'ç')
Key=L'Ç';
else if((UpCase(Key)<L'A'|| UpCase(Key)>L'Z')&& Key!=VK_DELETE && Key!=VK_BACK )
Key=0;
}
//---------------------------------------------------------------------------
 
 

 

Unit2.cpp

  1. //---------------------------------------------------------------------------
  2.  
  3. #include <vcl.h>
  4. #pragma hdrstop
  5. #include "Unit1.h"
  6. #include "Unit2.h"
  7. //---------------------------------------------------------------------------
  8. #pragma package(smart_init)
  9. #pragma resource "*.dfm"
  10. TForm2 *Form2;
  11. //---------------------------------------------------------------------------
  12. __fastcall TForm2::TForm2(TComponent* Owner)
  13.     : TForm(Owner)
  14. {
  15. }
  16. //---------------------------------------------------------------------------
  17. void __fastcall TForm2::Button1Click(TObject *Sender)
  18. {
  19. int x=ListBox1->ItemIndex;
  20. if(x<0)
  21. Application->MessageBox(L"2.Takımı Seçiniz",L"UYARI",MB_ICONINFORMATION) ;
  22. else
  23. {
  24.  String yazdir=Form1->ListBox1->Items->Strings[Form1->ListBox1->ItemIndex]+" ile "+Form2->ListBox1->Items->Strings[Form2->ListBox1->ItemIndex]+" Arasındaki Oynanan Maçın Skorunu Giriniz";
  25.  String skor=InputBox(L"SKOR GİR",yazdir.t_str(),"0-0");
  26.  char dizi[3];
  27.  strcpy(dizi,skor.t_str());
  28.  int skor1=StrToInt(dizi[0]);
  29.  int skor2=StrToInt(dizi[2]);
  30.  int averaj;
  31.  
  32.  int sira1=Form1->ListBox1->ItemIndex;
  33.  int sira2;
  34.  int puan;
  35.  
  36.  for(int z=0;z<Form1->ListBox1->Items->Count;z++)
  37.  {
  38.      if(Form2->ListBox1->Items->Strings[Form2->ListBox1->ItemIndex]==Form1->ListBox1->Items->Strings[z])
  39.      sira2=z;
  40.  }
  41.  
  42.  if(skor1>skor2)
  43.  {
  44.    puan=StrToInt(Form1->ListBox2->Items->Strings[sira1]);
  45.    puan+=3;
  46.    Form1->ListBox2->Items->Strings[sira1]=IntToStr(puan);
  47.    averaj=StrToInt(Form1->ListBox3->Items->Strings[sira1]);
  48.    averaj+=(skor1-skor2);
  49.    Form1->ListBox3->Items->Strings[sira1]=IntToStr(averaj);
  50.    averaj=StrToInt(Form1->ListBox3->Items->Strings[sira2]);
  51.    averaj-=(skor1-skor2);
  52.    Form1->ListBox3->Items->Strings[sira2]=IntToStr(averaj);
  53.  }
  54.  if(skor2>skor1)
  55.  {
  56.  
  57.    puan=StrToInt(Form1->ListBox2->Items->Strings[sira2]);
  58.    puan+=3;
  59.    Form1->ListBox2->Items->Strings[sira2]=IntToStr(puan);
  60.    averaj=StrToInt(Form1->ListBox3->Items->Strings[sira2]);
  61.    averaj+=(skor2-skor1);
  62.    Form1->ListBox3->Items->Strings[sira2]=IntToStr(averaj);
  63.    averaj=StrToInt(Form1->ListBox3->Items->Strings[sira1]);
  64.    averaj-=(skor2-skor1);
  65.    Form1->ListBox3->Items->Strings[sira1]=IntToStr(averaj);
  66.  }
  67.  if(skor1==skor2)
  68.  {
  69.    puan=StrToInt(Form1->ListBox2->Items->Strings[sira1]);
  70.    puan+=1;
  71.    Form1->ListBox2->Items->Strings[sira1]=IntToStr(puan);
  72.    puan=StrToInt(Form1->ListBox2->Items->Strings[sira2]);
  73.    puan+=1;
  74.    Form1->ListBox2->Items->Strings[sira2]=IntToStr(puan);
  75.  }
  76.  
  77.  
  78.  
  79. }
  80. Form1->ListBox4->Items->Clear();
  81. Form1->ListBox5->Items->Clear();
  82. Form1->ListBox6->Items->Clear();
  83. Form1->ListBox7->Items->Clear();
  84. Form1->ListBox8->Items->Clear();
  85. Form1->ListBox9->Items->Clear();
  86.  
  87. for(int l=0;l<Form1->ListBox1->Items->Count;l++)
  88. Form1->ListBox7->Items->Add(Form1->ListBox1->Items->Strings[l]);
  89. for(int l=0;l<Form1->ListBox2->Items->Count;l++)
  90. Form1->ListBox5->Items->Add(Form1->ListBox2->Items->Strings[l]);
  91. for(int l=0;l<Form1->ListBox3->Items->Count;l++)
  92. Form1->ListBox6->Items->Add(Form1->ListBox3->Items->Strings[l]);
  93.  
  94. for(int p=0;p<Form1->ListBox2->Items->Count;p++)
  95. {
  96.     for(int k=p+1;k<Form1->ListBox5->Items->Count;k++)
  97.     {
  98.         if(StrToInt(Form1->ListBox5->Items->Strings[p])<StrToInt(Form1->ListBox5->Items->Strings[k]))
  99.         {
  100.             String temp=Form1->ListBox5->Items->Strings[p];
  101.             Form1->ListBox5->Items->Strings[p]=Form1->ListBox5->Items->Strings[k];
  102.             Form1->ListBox5->Items->Strings[k]=temp;
  103.             String temp2=Form1->ListBox6->Items->Strings[p];
  104.             Form1->ListBox6->Items->Strings[p]=Form1->ListBox6->Items->Strings[k];
  105.             Form1->ListBox6->Items->Strings[k]=temp2;
  106.             String temp3=Form1->ListBox7->Items->Strings[p];
  107.             Form1->ListBox7->Items->Strings[p]=Form1->ListBox7->Items->Strings[k];
  108.             Form1->ListBox7->Items->Strings[k]=temp3;
  109.         }
  110.     }
  111. }
  112.  
  113. for(int p=0;p<Form1->ListBox5->Items->Count;p++)
  114. {
  115.     for(int k=p+1;k<Form1->ListBox5->Items->Count;k++)
  116.     {
  117.        if(Form1->ListBox5->Items->Strings[p]==Form1->ListBox5->Items->Strings[k])
  118.        {
  119.            if(StrToInt(Form1->ListBox6->Items->Strings[p])<StrToInt(Form1->ListBox6->Items->Strings[k]))
  120.            {
  121.             String temp=Form1->ListBox6->Items->Strings[p];
  122.             Form1->ListBox6->Items->Strings[p]=Form1->ListBox6->Items->Strings[k];
  123.             Form1->ListBox6->Items->Strings[k]=temp;
  124.             String temp1=Form1->ListBox7->Items->Strings[p];
  125.             Form1->ListBox7->Items->Strings[p]=Form1->ListBox7->Items->Strings[k];
  126.             Form1->ListBox7->Items->Strings[k]=temp1;
  127.            }
  128.        }
  129.  
  130.     }
  131. }
  132.  
  133. for(int i=0;i<Form1->ListBox1->Items->Count;i++)
  134. {
  135.  
  136.   String yazdir=Form1->ListBox7->Items->Strings[i];
  137.   Form1->ListBox4->Items->Add(yazdir) ;
  138.   yazdir=Form1->ListBox5->Items->Strings[i];
  139.   Form1->ListBox8->Items->Add(yazdir) ;
  140.   yazdir=Form1->ListBox6->Items->Strings[i];
  141.   Form1->ListBox9->Items->Add(yazdir) ;
  142.  
  143. }
  144.  
  145.  Form2->Close();
  146.  Form1->Show();
  147. }
  148. //---------------------------------------------------------------------------
  149.  

Yorumlar
Yeni Ekle Ara
+/-
Yorum yaz
Adınız:
E-posta:
 
Web Sayfas1:
Başlık:
UBB Kodu:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Lütfen resimdeki güvenlik kodunu giriniz.

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Son Güncelleme ( Cumartesi, 23 Mayıs 2009 01:00 )  

Üye Giriş Formu



Kimler Çevrimiçi

Yok