rownator.txt

(5 KB) Pobierz
Program do r�wna�
//-----------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <iostream.h>
#include "rownaniaprogram2.h"
#include<math.h>
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::p1Click(TObject *Sender)
{
 int a, b, x;
a = wp1->Text.ToIntDef(1);
x = wp2->Text.ToIntDef(1);
b = wp3->Text.ToIntDef(1);
w5->Caption = IntToStr(a*x+b);
w26->Caption = IntToStr(b);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::p2Click(TObject *Sender)
{
int ak, bk, ck, x1, x2, delta;

ak = wp4->Text.ToIntDef(1);
bk = wp6->Text.ToIntDef(1);
ck = wp7->Text.ToIntDef(1);
delta = (bk*bk)-(4*ak*ak*ck);
if(delta>0)
{ x1= (-bk + sqrt(delta))/2*ak;
w10->Caption = "x1 wynosi:";
    w11->Caption = IntToStr(x1);
x2 =  (-bk - sqrt(delta))/2*ak;
   w7->Caption = "x2 wynosi:";
    w27->Caption = IntToStr(x2);

}
else if(delta==0)
{
x1 = -bk/(2*ak);
w10->Caption = "x wynosi:";
w11->Caption = IntToStr(x1);
w27->Caption = "";
w7->Caption = "";
 }
else if(delta<0)
{ w10->Caption = "x wynosi:";
 w11->Caption = "R�wnanie nie ma rozwiaza�";
 w27->Caption = "";
   w7->Caption = "";
}

}
//---------------------------------------------------------------------------

void __fastcall TForm1::p3Click(TObject *Sender)
{ int a1, a2, b1, b2, c1, c2, wb, wc, y, x;

a1 = wp8->Text.ToIntDef(1);
b1 = wp9->Text.ToIntDef(1);
c1 = wp10->Text.ToIntDef(1);

a2 = wp11->Text.ToIntDef(1);
b2 = wp12->Text.ToIntDef(1);
c2 = wp13->Text.ToIntDef(1);



wb=(-a2)*b1+b2*a1;
wc=(-a2)*c1+c2*a1;

if (wb==0)
{
if(wb==wc)
{
w22->Caption = "Uk�ad";
w23->Caption = "Nieoznaczony";
}
else
{
w22->Caption = "Uk�ad";
w23->Caption = "Sprzeczny";
}  }
if(wb!=0) {
y =wc/wb;
x=(-b1*y+c1)/a1;


w22->Caption = IntToStr(x);
w23->Caption = IntToStr(y);
}
}
//-------KONIEC---------------------------------------------------------------------
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------




















Program do skali ocen
//----------------------------------------------------------------------------------


#include <vcl.h>
#pragma hdrstop
#include "punkt.h"
#pragma package(smart_init)
#pragma link "CSPIN"
#pragma resource "*.dfm"
TForm1 *Form1;


//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}

void Start()
{
Form1->Combo->Items->Clear();

if(FileExists("DATA.bin"))
Form1->Lista->Items->LoadFromFile("DATA.bin");
else
Form1->Lista->Items->SaveToFile("DATA.bin");

for(int i=0;i<Form1->Lista->Items->Count;i++)
{
Form1->Lista->ItemIndex=i;
Form1->Combo->Items->Add(Form1->Lista->Items->Strings[i].SubString(11,20));
}
}

//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Start();
}
void __fastcall TForm1::GoClick(TObject *Sender)
{
if(Combo->ItemIndex>=0)
{
int a;

Lista->ItemIndex=Combo->ItemIndex;

a=StrToInt(Lista->Items->Strings[Lista->ItemIndex].SubString(1,2));
l2->Caption=IntToStr((Max->Value * a / 100)) + " pkt";

a=StrToInt(Lista->Items->Strings[Lista->ItemIndex].SubString(3,2));
l3->Caption=IntToStr((Max->Value * a / 100)) + " pkt";

a=StrToInt(Lista->Items->Strings[Lista->ItemIndex].SubString(5,2));
l4->Caption=IntToStr((Max->Value * a / 100)) + " pkt";

a=StrToInt(Lista->Items->Strings[Lista->ItemIndex].SubString(7,2));
l5->Caption=IntToStr((Max->Value * a / 100)) + " pkt";

a=StrToInt(Lista->Items->Strings[Lista->ItemIndex].SubString(9,2));
if(a==00)
a=100;
l6->Caption=IntToStr((Max->Value * a / 100)) + " pkt";

}
else
ShowMessage("Wybierz schemat ocen!");
}

//---------------------------------------------------------------------------
void __fastcall TForm1::AddClick(TObject *Sender)
{
if(Name->Text!="Nazwa schematu")
{
String nowa;

if(s2->Value<10)
nowa="0"+nowa;
nowa+=IntToStr(s2->Value);

if(s3->Value<10)
nowa="0"+nowa;
nowa+=IntToStr(s3->Value);

if(s4->Value<10)
nowa="0"+nowa;
nowa+=IntToStr(s4->Value);

if(s5->Value<10)
nowa="0"+nowa;
nowa+=IntToStr(s5->Value);

if(s6->Value<10)
nowa="0"+nowa;
nowa+=IntToStr(s6->Value);

nowa+=Name->Text;

Lista->Items->Add(nowa);
Lista->Items->SaveToFile("DATA.bin");
Start();
ShowMessage("Schemat zosta� pomy�lnie dodany");
Form1->Height=300;
Down->Caption="v";
}
else
ShowMessage("Podaj nazw� dla shematu!");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::DownClick(TObject *Sender)
{
if(Down->Caption=="v")
{
Form1->Height=530;
Down->Caption="^";
}
else
{
Form1->Height=300;
Down->Caption="v";
}

}

//-------KONIEC---------------------------------------------------------------------
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
Zgłoś jeśli naruszono regulamin