Tekil Mesaj gösterimi
Alt 11 Temmuz 2014, 10:16   #1
Çevrimdışı
Swat
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Not Ortalaması Hesaplama




C++ Builder projesidir.

StringGrid kontrolü yardımıyla not ortalamasını hesaplamayı sağlayan bir programdır. Vize ve final notu girilen öğrencinin ortalamasını hesaplar. Stringgrid kontrolünde tab ile hareket edilebilmesi için Options kısmından goTabs true yapılması gerekir.

Kod:   Kodu kopyalamak için üzerine çift tıklayın!
//--------------------------------------------------------------------------- #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 k,j,sayi; k=StrToInt(Edit1->Text); this->StringGrid1->RowCount=k; this->StringGrid1->ColCount=7; this->StringGrid1->Cells[0][0]="Sira No"; this->StringGrid1->Cells[1][0]="Ogrenci No"; this->StringGrid1->Cells[2][0]="Adi Soyadi"; this->StringGrid1->Cells[3][0]="1.Vize"; this->StringGrid1->Cells[4][0]="Final"; this->StringGrid1->Cells[5][0]="Ortalama"; this->StringGrid1->Cells[6][0]="Harf Notu"; this->Button2->Enabled=true; this->Button3->Enabled=true; this->Button4->Enabled=true; for(j=1;j<StringGrid1->RowCount;j++) { sayi=j; this->StringGrid1->Cells[0][j]=IntToStr(sayi); } } //--------------------------------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender) { int*Vize; Vize=new int [this->StringGrid1->RowCount]; int i; for(i=1;i<StringGrid1->RowCount;i++) { Vize[i]=StrToInt(StringGrid1->Cells[3][i]); } float ortalama; float toplam=0; for(i=1;i<StringGrid1->RowCount;i++) { toplam+=Vize[i]; } ortalama=toplam/(this->StringGrid1->RowCount-1); Button2->Caption=FloatToStr(ortalama); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button3Click(TObject *Sender) { int*Final; Final=new int [this->StringGrid1->RowCount]; int i; for(i=1;i<StringGrid1->RowCount;i++) { Final[i]=StrToInt(StringGrid1->Cells[4][i]); } float Finalortalamasi; float toplam=0; for(i=1;i<StringGrid1->RowCount;i++) { toplam+=Final[i]; } Finalortalamasi=toplam/(this->StringGrid1->RowCount-1); Button3->Caption=FloatToStr(Finalortalamasi); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button4Click(TObject *Sender) { float a,b; int i,j; float sonuc; for(i=1;i<StringGrid1->RowCount;i++) { a=StrToFloat(this->StringGrid1->Cells[3][i]); b=StrToFloat(this->StringGrid1->Cells[4][i]); sonuc=((a*40.0)/100.0)+((b*60.0)/100.0); this->StringGrid1->Cells[5][i]=FloatToStr(sonuc); if(sonuc>100) {StringGrid1->Cells[6][i]="Gecersiz Not"; } else if(sonuc<=100 && sonuc>91) {StringGrid1->Cells[6][i]="AA"; } else if(sonuc<=91 && sonuc>83) {StringGrid1->Cells[6][i]="BA"; } else if(sonuc<=83 && sonuc>75) {StringGrid1->Cells[6][i]="BB"; } else if(sonuc<=75 && sonuc>67) {StringGrid1->Cells[6][i]="CB"; } else if(sonuc<=67 && sonuc>59) {StringGrid1->Cells[6][i]="CC"; } else if(sonuc<=59 && sonuc>49) {StringGrid1->Cells[6][i]="DC"; } else if(sonuc<=49 && sonuc>39) {StringGrid1->Cells[6][i]="DD"; } else if(sonuc<=39 && sonuc>29) {StringGrid1->Cells[6][i]="FD"; } else if(sonuc<=29 && sonuc>=0) {StringGrid1->Cells[6][i]="FF"; } } } //--------------------------------------------------------------------------- void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action) { int c; c=MessageDlg("Cikmak istiyor musunuz?",mtConfirmation,TMsgDlgButtons()<<mbYes<<mbNo,0); if(c==mrNo)//No secildiyse) Action=caNone;//Cikisi iptal et } //---------------------------------------------------------------------------


 
Alıntı ile Cevapla

IRCForumlari.NET Reklamlar
sohbet odaları reklamver bizimmekan