2-amaliy mashg`ulot. Mavzu: Turbo Pascal dasturlash muhiti. Pascal tilida ifodalaming yozilishi. Chiziqli operatorlar dastur. Sharti oldindan beriluvchi, sharti keyin beriluvchi operatorlaridan foydalanib dasturlar tuzish


Download 76.4 Kb.
bet4/4
Sana24.07.2023
Hajmi76.4 Kb.
#1662118
1   2   3   4
Bog'liq
4-amaliy mashg`ulot. Mavzu Turbo Pascal dasturlash muhiti. Pasc-fayllar.org

2-TOPSHIRIQ:

1. Paskal dasturida quyidagi tarmoqlanuvchi dasturlarni tuzing:

Kiritilgan son 25 da katta bo`lsa, “katta”, aks holda ”kichik” degan yozuvni chiqaradigan dastur tuzing.


Kiritilgan son yoshingizdan katta bo`lsa, “katta”, aks holda ”kichik” degan yozuvni chiqaradigan dastur tuzing.




Program taqqoslash;

Var a:real;

Begin

If a>25 then writeln(‘katta’) else

Writeln(‘kichik’);

End.




Parol to`g’ri kiritilganligini tekshiruvchi dastur tuzing


( parol=”informatika”)


Ismingizni to`g’ri kiritilganligini tekshiruvchi dastur tuzing.




Program Parolni_tekshirish;

Var parol:String;

Begin

Write(‘parolni kiritng:’)Readln(parol);

If parol=’informatika’ then

writeln(‘parol tugri’) else

Writeln(‘parol notugri’);End.




2. Paskal dasturida quyidagi takrorlanuvchi dasturlarni tuzing:

Ekranga ”Informatika” so`zini 20 marta chiqaruvchi dastur tuzing:


Ekranga familiya va ismingizni 10 marta chiqaruvchi dastur tuzing:




Program takrorlash;

Var i: integer;

Begin

For i:=1 to 20 do

Writeln(‘Informatika’);

end.



Tasodifiy sonlar generatori (Ramdom)dan foydalanib, ekranga har xil rangda “A” harfini chiqaruvchi dastur tuzing. Qizil rangli A chiqishi bilan dastur ishi yakunlansin.


Tasodifiy sonlar generatori (Ramdom)dan foydalanib, ekranga har xil rangda “A” harfini chiqaruvchi dastur tuzing.Qizil rangli A chiqishi bilan dastur ishi yakunlansin.




Program Rangli_harflar;

Var rang:integer;

Begin

Randomize;

Repeat

Rang:=Round(Random(15));

TextColor(rang);

Write(‘A’);

Until rang=4;

End.




3. Paskal dasturida quyidagi dasturlarni tuzing:

Quyidagi amallar bajarilgach, uning qiymatini aniqlang. Bunda s=”Informatika”






a) Concat(‘o’,’na’);

b)a:=’dunyo’; Length(a);

c)Pos(‘o’,’bahor’);

d)delete(s,6,4);

e)Copy(‘kino’,1,2)+copy(‘oftob’,3,3);




2.

Berilgan ”mustaqil”,”Uzbekiston”, ”davlat” so`zlaridan ”Uzbekiston mustaqil davlat” iborasini hosil qiluvchi dastur tuzing.


Berilgan ”Familiya”,”Ism”, ”sharif” so`zlaridan ”Familiya ism sharif” iborasini hosil qiluvchi dastur tuzing.




Program suz_yasash;

Const a=’mustaqil’, b=’Uzbekiston’,c=’davlat’;

Var d: String;

d:=Concat(b,a,c); Writeln(d); end.




3.

Kiritilgan so`zni teskarisiga o`girib beruvchi dastur tuzing. M: “ota” so`zidan “ato” so`zini.






Program teskari;

Var a,b: String; i,len:integer; belgi: char;

begin

write(’suz kiriting:’); readln(a);

Len:=Length(a);

for i:=1 to len do

begin

belgi:=Copy(ai,1);

b:=belgi+b;

end;

write(b);end.




4.

Berilgan ”Saodat” va ”Qadoq” so`zlaridan ”Sadoqat” so`zini yasovchi dastur tuzing.


Berilgan ”Informatsiya” va ”Kibernetika” so`zlaridan ”Informatika” so`zini yasovchi dastur tuzing.




Program suz_yasash;

Var a,b:String;

begin

a:=’saodat’; b:=’qadoq’;

Delete(a,3,2);

Delete(b,1,2);

Insert(b,a,3);

Writeln(a);

end.




5.

Berilgan so`zning belgilari orasiga bittadan probel qo`shib chiquvchi dastur tuzing.






Program probel;

Uses crt;

Var a: String; i:integer;

Begin

ClrScr;

Write('suzni kiriting=');read(a);

For i:=1 to length(a) do

Begin

write(a[i],' ');

End;end.




4.Paskal dasturida quyidagi dasturlarni tuzing:

Uchlarining koordinatalari (10,10) va (630,470) bo`lgan sariq fonli ko`k rangli kesma tasvirini chizish dasturini tuzing.


  1. Paskal dasturida quyidagi shaklni chizish dasturini tuzing:




Program kesma;

UsesGraph;

var gd,gm:integer;

Begin

Gd:=Detect; InitGraph(gd,gm,’’);

SetBKColor(Yellow);SetColor(Blue);

Line(10,10,630,470);

end.






2.

Markazi (300,200) nuqtada radiusi 100 bo`lgan yashil rangli aylana tasvirini chizish dasturini tuzing.




Program aylana;

UsesGraph;

var gd,gm:integer;

Begin

Gd:=Detect; InitGraph(gd,gm,’’);

SetBKColor(Yellow);SetColor(Green);

Circle(3000,2000,100);

end.


3.

Chap yuqori burchagi(10,10) o`ng quyi burchagi (200,100) nuqtalarda bo`lgan ko`k rangli to`gri to`rtburchak tasvirini chizish dasturini tuzing.




Program turtburchak;

UsesGraph;

var gd,gm:integer;

Begin

Gd:=Detect; InitGraph(gd,gm,’’);

SetBKColor(7);SetColor(1);

Rectangle(10,10,200,100);

end.


5. Paskal dasturida quyidagi dasturlarni tuzing:


1.

Ichi qizil rangli qali gorizontal chiziqlar bilan to`ldirilgan to`g’ri to`rtburchak tasvirini chizish dasturini tuzing.




  1. Paskal dasturida quyidagi shaklni chizish dasturini tuzing:




Program qizil_ turtburchak;

UsesGraph;

var gd,gm:integer;

Begin

Gd:=Detect; InitGraph(gd,gm,’’);

SetFillStyle(2,4);

Bar(10,10,400,300);

end.






2.

Markazi (320,240) nuqtada radiuslari 100 va 200 bo`lgan ichi ko`k rangli o`gma katak chiziqlar bilan to`ldirilgan qizil ellips tasvirini chizish dasturini tuzing.




Program yashil_ellips;

UsesGraph;

var gd,gm:integer;

Begin

Gd:=Detect; InitGraph(gd,gm,’’);

SetColor(red);

SetFillStyle(8,1);

FillEllipse(320,240,100,200);

end.


3.

Chap yuqori burchagi(100,100) o`ng quyi burchagi (200,300) nuqtalarda, balandligi 50 bo`lgan qizil rangli parallelepiped tasvirini chizish dasturini tuzing.


  1. Svetofor tasvirini chizish dasturini tuzing:




Program parallelepiped;

UsesGraph;

var gd,gm:integer;

Begin

Gd:=Detect; InitGraph(gd,gm,’’);

SetColor(red);

SetFillStyle(1,9);

Bar3D(100,100,200,300,50,True);

end.






2


Topshirdi:




Qabul qildi:






http://fayllar.org
Download 76.4 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling