Not Ortalaması Hesaplama

Ahbap

Harbi Üye
Forum Üyesi
Katılım
29 Mayıs 2019
Mesajlar
8,562
Tepkime puanı
2
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:
//---------------------------------------------------------------------------
 
#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
}
//---------------------------------------------------------------------------
 

Benzer konular

DarK

< MasaLFM.Net >
Forum Üyesi
Katılım
1 Nisan 2019
Mesajlar
622
Tepkime puanı
0
emeğine yüreğine sağlık
 

Nutella

Harbi Üye
Bayan Üye
Özel Üye
Katılım
2 Ocak 2021
Mesajlar
9,432
Tepkime puanı
8
Cinsiyet
  1. Bayan
Takım
Galatasaray
Paylaşım için teşekkürler.
 
İçerik sağlayıcı "paylaşım" sitelerinden biri olan Harbimekan.Com Forum, Eğlence ve Güncel Paylaşım Platformu Adresimizde 5651 Sayılı Kanun’un 8. Maddesine ve T.C.K’nın 125. Maddesine göre TÜM ÜYELERİMİZ yaptıkları paylaşımlardan sorumludur. Harbimekan.Com sitesindeki konular yada mesajlar hakkında yapılacak tüm hukuksal Şikayetler için info@harbimekan.com yada iletişim sayfası üzerinden iletişime geçilmesi halinde ilgili kanunlar ve yönetmelikler çerçevesinde en geç 3 Gün (72 Saat) içerisinde Forum yönetimi olarak tarafımızdan gereken işlemler yapılacaktır.

Bu Site, Bilim ve Sağlık Haber Ajansı Üyesidir.

Yığıntı - 8kez - kaynak mağazam - Uğur Ağdaş - genel forum - webp converter