Estrutura de seleção
case of
caso 1: blabla
caso 2: tatata
caso 3: haha
end;
//Botão OK//
Case strtoint (edit1.text) of
0..12: edit2.text:='criança';
13..18: edit2.text:='adolescente';
19..60: edit2.text:='adulto';
61..150: edit2.text:='idoso';
end;
(//http://img407.imageshack.us/img407/1811/imagemkm7.jpg) (//http://imageshack.us)
//TTimer//
randomize;
case random (6) of
0:shape1.shape:=stcircle;
1:shape1.shape:=stroundsquare;
2:shape1.shape:=strectangle;
3:shape1.shape:=streactangle;
4:shape1.shape:=stroundraect;
5:shape1.shape:=stellipse
end;
//LIGA//
timer1.enabled:=true;
(//http://img294.imageshack.us/img294/2535/imagemdb0.jpg) (//http://imageshack.us)
(//http://img241.imageshack.us/img241/4273/imagem2vf3.jpg) (//http://imageshack.us)
Para adicionar mais formas ai SHAPE...
//TTimer//
randomize;
case random (6) of
0:shape1.shape:=stcircle;
1:shape1.shape:=stroundsquare;
2:shape1.shape:=strectangle;
3:shape1.shape:=streactangle;
4:shape1.shape:=stroundraect;
5:shape1.shape:=stellipse
end;
case random ( 8 ) of
0:shape1.brush.style:=bssolid;
1:shape1.brush.style:=bsbdiagonal;
3:shape1.brush.style:=bscross;
4:shape1.brush.style:=bsdiagcross;
5:shape1.brush.style:=bsvertical;
6:shape1.brush.style:=bshorizontal;
7:shape1.brush.style:=bsclear;
end;
shape1.brush.color:=rgb(random(255), random (255), random(255));
shape1.pen.color:=rgb(random(255), random (255), random(255));
(lembrando que o case random é igual o anterior, só muda a adição do case random "8")
(//http://img98.imageshack.us/img98/1255/imagem3gw9.jpg) (//http://imageshack.us)
Estrutura de repetição
repeat
declarações
until
exemplo:
//button//
var x:real;
begin
repeat
memo1.lines.add(floattostr(x));
x:=x+1;
until (x>6);
(//http://img98.imageshack.us/img98/2329/53953951ki5.jpg) (//http://imageshack.us)
(//http://img98.imageshack.us/img98/9965/81493427wp6.jpg) (//http://imageshack.us)
Vetores e matrizes
(estáticos e dinâmicos)
sintaxe:
Estático
var
v: array [0..10] of integer;
string;
real;
.
.
.
m: array [0..10,0..5] of integer;
string;
real;
.
.
.
Dinamicos
Var
v: array of integer;
string;
real;
.
.
.
m: array of integer;
string;
real;
.
.
.
begin
setlength (v,11);
setlength (m, 11, 6);
(//http://img146.imageshack.us/img146/2305/11111111ev3.jpg) (//http://imageshack.us)
//Button Estático//
var
m: array [0..100] of integer;
i: integer;
begin
for i:= 0 to 100 do
begin
m :=i ;
memo1.lines.add (inttostr(m));
end;
end;
//Button Dinâmico//
var
m: array of integer;
i, t: integer;
begin
t:= strtoint (inputbox('Novo tamanho:','Digite o tamanho:','100'));
setlength (m, t);
for i:= 0 to t do
begin
m := i;
memo1.lines.add (inttostr(m));
end;
end;
{espero q gostem e ajude a alguem...}
abração, fui!!!
Não poderia deixar de passar aqui e não te parabenizar pelo tuto !!
Parabéns Watila !!!!
Bem explicado !!!!