Муҳаммад ал-хоразмий номидаги тошкент ахборот технологиялари
Borland C++->File->New->Application
Download 3.44 Mb. Pdf ko'rish
|
KIBER XAVFSIZLIK MUAMMOLARI VA ULARNING (1)
Borland C++->File->New->Application.
Yangi formaga komponentalar palitrasidan kerakli komponentalarni formaga joylashtiramiz. Standart tarkibidan label va button tugmachalarni formaga ketma- ket joylashtiriladi. So’ngra System tarkibidan TPaintBox formaga joylashtiriladi. Funksiyaga doir argumentlarni kiritishda qadam berish va otilish burchak kattaliklariga e’tibor berish kerak. Quydagi dastur kodlarini kiritganimizdan so’ng kompillyatsiya jarayonini amalga oshirishimiz mumkin. # include #include #pragma hdrstop #include "Unit4.h" #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } void __fastcall TForm1::Button1Click(TObject *Sender) { double g=10,t,v0,pi=3.1415926; double x,x1,f,h,x2,x0,y0,fx,fy; Canvas->MoveTo(450,200); Canvas->LineTo(440,205); Canvas->MoveTo(450,200); Canvas->LineTo(440,195); Canvas->MoveTo(10,0); Canvas->LineTo(5,15); Canvas->MoveTo(10,0); Canvas->LineTo(15,15); Canvas->MoveTo(10,200); Canvas->LineTo(10,0); Canvas->MoveTo(450,200); Canvas->LineTo(10,200); Canvas->TextOutA(20,5,"Y"); Canvas->TextOutA(450,210,"X"); f=StrToInt(Edit1->Text); v0=StrToInt(Edit2->Text); x=v0*v0*sin(2*pi*f/180)/(2*g); t=2*v0*sin(pi*f/180); h=v0*v0*sin((pi*f/180)*sin(pi*f/180))/(2* g); Label1->Caption="H= "+FloatToStr(h)+"m; t="+FloatToStr(t)+"s; L= "+FloatToStr(x)+"m"; x0=10;y0=200; x1=0;x2=400; x=x1; while (x t=x/(v0*cos(pi*f/180)); fx=x0+5*x; fy=y0-5*(v0*sin(pi*f/180)*t-g*t*t/2); PaintBox1->Canvas- >Pixels[fx][fy]=clBlue; x=x+0.0004; } } void __fastcall TForm1::Button2Click(TObject *Sender) { double g=10,t,v0,pi=3.1415926; double x,x1,f,h,x2,x0,y0,fx,fy; f=StrToInt(Edit3->Text); v0=StrToInt(Edit4->Text); x=v0*v0*sin(2*pi*f/180)/(2*g); t=2*v0*sin(pi*f/180); h=v0*v0*sin((pi*f/180)*sin(pi*f/180))/(2* g); Label2->Caption="H= "+FloatToStr(h)+"m; t="+FloatToStr(t)+"s; L= "+FloatToStr(x)+"m"; x0=10;y0=200; x1=0;x2=400; x=x1; while (x t=x/(v0*cos(pi*f/180)); fx=x0+5*x; 74 fy=y0-5*(v0*sin(pi*f/180)*t-g*t*t/2); PaintBox1->Canvas- >Pixels[fx][fy]=clRed; x=x+0.0004; } } void __fastcall TForm1::Button3Click(TObject *Sender) { double g=10,t,v0,pi=3.1415926; double x,x1,f,h,x2,x0,y0,fx,fy; f=StrToInt(Edit5->Text); v0=StrToInt(Edit6->Text); x=v0*v0*sin(2*pi*f/180)/(2*g); t=2*v0*sin(pi*f/180); h=v0*v0*sin((pi*f/180)*sin(pi*f/180))/(2* g); Label3->Caption="H= "+FloatToStr(h)+"m; t="+FloatToStr(t)+"s; L= "+FloatToStr(x)+"m"; x0=10;y0=200; x1=0;x2=400; x=x1; while (x t=x/(v0*cos(pi*f/180)); fx=x0+5*x; fy=y0-5*(v0*sin(pi*f/180)*t-g*t*t/2); PaintBox1->Canvas- >Pixels[fx][fy]=clGreen; x=x+0.0004; } } 75 1-rasm. Borland C++ dasturlash tilini ishga tushiramiz Formaga otilish burchagi va boshlang’ich tezlikning istalgan qiymatini kiritsak aniq natija kelib chiqishi bilan birgalikda grafik tasvirlari ham namoyon bo’ladi. Borland C++ dasturlash tilida gorizontga burchak ostida otilgan jism harakatida uchish uzoqligi, uchish vaqti, maksimal ko’tarilish balandligini hisoblash, harakat trayektoriyasini vizuallashtirish dasturini tuzishni amalga oshirdik. Bunday dasturlardan ta’lim sohasida fizika fanidan amaliy mashg’ulotlar jarayonida foydalanish mumkin. Borland C++ dasturlash tilida bu kabi dasturlar tuzish fizik jarayonlarni modellashtirish, laboratoriya ishlarini bajarishda ma’lumotlar tuzilmasini yaratish, multimediyali ishlanmalar tayyorlash kabi katta imkoniyatlar yaratadi. Informatika, fizika va matematika fanlarining fanlararo uzviyligini ta’minlaydi. Xulosa qilib shuni aytish mumkinki, dasturlash tillari orqali fizik jarayonlarni vizuallshtirish amaliy jihatdan yuqori natijalar berishi bilan birga o’quvchilarning aniq va tabiiy fanlarga bo’lgan qiziqishini oshiradi. Download 3.44 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling