Pascal Örnekleri 5 ( Stringler ve Gotoxy)
Bu makalede string veriler ve gotoxy ile ilgili değişik örnekler var. Sizleri farklı bakış açılarına iteceğini düşündüğümüz bu örnekler eğlenceli de olacaktır eminim.49)Saat programı
Çöz:49)uses crt;
var
saat,dakika,saniye,salise:integer;
begin
clrscr;
writeln(‘13.11.2006′);
for saat:=15 to 23 do
for dakika:=45 to 59 do
for saniye:=0 to 59 do
for salise:=0 to 59 do
begin
gotoxy(5,10);
delay(10);
writeln(saat,’:’,dakika,’:’,saniye,’:’,salise,’:’);
end;
readln;
end.
50)İsmi ekrana 3 blok halinde ortalı yazan program.
Çöz:50)uses crt;
var
x,y:integer;
begin
clrscr;
for x:=1 to 3 do
for y:=1 to 10 do begin
gotoxy(30*x-25,2*y);
writeln(‘sonnur’);
end;
readln;
end.
51)İsmi ekranda yarısında yazmaya başlayan program.
Çöz:51)uses crt;
var
x,y:integer;
begin
clrscr;
for x:=1 to 3 do
for y:=1 to 5 do
begin
gotoxy(30*x-25,2*y+14);
writeln(‘sonnur’);
end;
readln;
end.
52)İsmi ekranda sekiz bloklu yazan program.
Çöz:52)uses crt;
var
x,y:integer;
begin
clrscr;
for x:=1 to 8 do
for y:=1 to 10 do
begin
gotoxy (9*x-3,2*y);
writeln(‘sonnur’); end;
readln;
end.
53)Ekrandaki isimin ortasını kare şeklinde yazmayan program.
Çöz:53)uses crt;
var
x,ad,a,i:integer;
begin
clrscr;
for i:=1 to 8 do
for a:=1 to 8 do
begin
gotoxy(9*i-3,3*a);
if (i>=3) and (i<=6) and (a>=3) and (a<=6) then
writeln(”)
else
writeln(‘sonnur’);
end;
readln;
end.
54)L harfi şeklinde yazan program.
Çöz:54) uses crt;
var
x,y:integer;
begin
clrscr;
for x:=1 to 8 do
for y:=1 to 8 do
begin
gotoxy(9*x-3,3*y);
if (x>=3) and (y<=6) then
writeln(”)
else
writeln(‘sonnur’);
end;
readln;
end.
55)Kare şeklinde ismi ekranda yazan program.
Çöz:55)uses crt;
var
x,y:integer;
begin
clrscr;
for x:=1 to 8 do
for y:=1 to 8 do
begin
gotoxy(9*x-3,3*y);
if (x>=2) and (y<=7) and (y>=2) and (x<=7) then
writeln(”)
else
writeln(‘sonnur’);
end;
readln;
end.
56)U şeklinde ismi ekrana yazan program.
Çöz:56)uses crt;
var
x,y:integer;
begin
clrscr;
for x:=1 to 8 do
for y:=5 to 8 do
begin
gotoxy(9*x-3,3*y);
if (x>=2) and (y<=7) and (y>=2) and (x<=7) then
writeln(”)
else
writeln(‘sonnur’);
end;
readln;
end.
57)Klavyeden girilen ismin azalrak yazan program.
Çöz:57)uses crt;
var
x,i:integer;
ad,isim:string;
begin
clrscr;
readln(isim);
x:=length(isim);
for i:=1 to x do begin
ad:=copy(isim,1,i);
writeln(ad);
end;
readln;
end.
58)İsmi kelebek şeklinde yazan program.
Çöz:58)uses crt;
var
i,x:integer;
ad,isim:string;
begin
clrscr;
readln(isim);
x:=length(isim);
for i:=1 to x do
begin
gotoxy(30,5+i);
ad:=copy(isim,1,i);
write(ad,’ ‘:14-i*2);
ad:=copy(isim,7-i,i);
write(ad,’ ‘);
gotoxy(30,10+i);
ad:=copy(isim,i,9-i);
write(ad,’ ‘:i*2);
ad:=copy(isim,1,7-i);
write(ad,’ ‘);
end;
readln;
end.
59)Dört köşeden azalan isimi ekrana yazan program.
Çöz:59)uses crt;
var
i,x:integer;
ad,isim:string;
begin
clrscr;
readln(isim);
x:=length(isim);
for i:=1 to x do
begin
gotoxy(30,5+i);
ad:=copy(isim,1,7-i);
write(ad,’ ‘:i*2);
ad:=copy(isim,i,9-i);
write(ad,’ ‘);
gotoxy(30,11+i);
ad:=copy(isim,1,i);
write(ad,’ ‘:14-i*2);
ad:=copy(isim,7-i,i);
write(ad,’ ‘);
end;
readln;
end.