Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program programa;
- uses crt;
- var op,op1,i,aux,colortext,colorback,h,m,s:integer;
- procedure menu_(x,y,tamanho,cor_atual:integer);
- var i,a:integer;
- begin
- textcolor(4);
- gotoxy(x,y);
- for i:=1 to tamanho do
- write('#');
- for i:=1 to (tamanho-22) do
- begin
- gotoxy(x,y+i);
- write('#');
- gotoxy(x+tamanho-1,y+i);
- writeln('#');
- end;
- gotoxy(x,tamanho+1-22);
- for i:=1 to tamanho do
- write('#');
- textcolor(cor_atual)
- end;
- Procedure menu(op,x,y,cor_atual:integer); //op-> 0=menu principal 1=menu de funçoes
- begin
- //procedimento que escreve menu no ecra
- case op of
- 0:begin
- menu_(20,1,31,cor_atual);
- gotoxy(x+8,y);
- writeln('---MENU---');
- gotoxy(x,y+2);
- writeln('1- Opções de Visualização');
- gotoxy(x,y+3);
- writeln('2- Temporizador');
- gotoxy(x,y+4);
- writeln('3- Cronómetro');
- gotoxy(x,y+5);
- writeln('0- Sair');
- writeln;
- end;
- 1:begin
- menu_(20,1,31,cor_atual);
- gotoxy(x+8,y);
- writeln('---MENU---');
- gotoxy(x,y+2);
- writeln('1- Cor de texto');
- gotoxy(x,y+3);
- writeln('2- Cor de fundo');
- gotoxy(x,y+4);
- writeln('3- Efeitos de cores');
- gotoxy(x,y+5);
- writeln('0- Anterior');
- writeln;
- end;
- end;
- end;
- //PROCEDIMENTOS QUE ALTERAM A COR //
- {
- 0->Preto
- 1->Azul
- 2->Verde
- 3->Azul-marinho
- 4->Vermelho
- 5->Laranja
- 6->Marrom
- 7->Cinza-claro
- 8->Cinza-escuro}
- Procedure cod_cores;
- begin
- writeln('-------------------Código de Cores-------------------');
- writeln('0->Preto');
- writeln('1->Azul');
- writeln('2->Verde');
- writeln('3->Azul-marinho');
- writeln('4->Vermelho');
- writeln('5->Laranja');
- writeln('6->Marrom ');
- writeln('7->Cinza-claro ');
- writeln('8->Cinza-escuro');
- end;
- Procedure cor_fundo(var cor:integer);
- var i:integer;
- begin
- for i:=1 to 1990 do
- begin
- textbackground(cor);
- write(' ');
- end;
- end;
- //FIM DOS PROCEDIMENTOS//
- Procedure temporizador(horas,minutos,segundos:integer);
- var h,m,s:integer;ini,ent:boolean;
- begin
- ini:=false;
- ent:=false;
- writeln('Para parar pressione qualquer tecla');
- for h:=horas downto 0 do
- begin
- if (minutos<59) and (not ent) then
- begin
- ent:=true;
- for m:=minutos downto 0 do
- begin
- if (segundos<59) and (not ini) then
- begin
- ini:=true;
- for s:=segundos downto 0 do
- begin
- write(h,':',m,':',s);
- delay(1000);
- clrscr;
- writeln('Para parar pressione qualquer tecla');
- if keypressed then
- exit;
- end;
- end
- else
- begin
- for s:=59 downto 0 do
- begin
- write(h,':',m,':',s);
- delay(1000);
- clrscr;
- writeln('Para parar pressione qualquer tecla');
- if keypressed then
- exit;
- end;
- end;
- end;
- end
- else
- begin
- for m:=59 downto 0 do
- begin
- ent:=true;
- if (segundos<59) and (not ini) then
- begin
- ini:=true;
- for s:=segundos downto 0 do
- begin
- write(h,':',m,':',s);
- delay(1000);
- clrscr;
- writeln('Para parar pressione qualquer tecla');
- if keypressed then
- exit;
- end;
- end
- else
- begin
- for s:=59 downto 0 do
- begin
- write(h,':',m,':',s);
- delay(1000);
- clrscr;
- writeln('Para parar pressione qualquer tecla');
- if keypressed then
- exit;
- end;
- end;
- end;
- end;
- end;
- end;
- Procedure cronometro;
- var h,m,s:integer;
- begin
- writeln('Para parar pressione qualquer tecla');
- for h:=0 to 24 do
- for m:=0 to 59 do
- for s:=0 to 59 do
- begin
- writeln(h,':',m,':',s);
- delay(1000);
- clrscr;
- writeln('Para parar pressione qualquer tecla');
- if keypressed then
- exit;
- end;
- end;
- Procedure muda_cores;
- var tipo:integer;
- begin
- while not keypressed do
- begin
- randomize;
- tipo:=random(3)+1;
- textbackground(random(8)+1);
- case tipo of
- 1:
- for i:=1 to 4 do
- begin
- clrscr;
- textbackground(random(8)+1);
- delay(70);
- end;
- 2:
- for i:=1 to 700 do
- begin
- write(' ');
- textbackground(random(8)+1);
- delay(3);
- end;
- 3:
- for i:=1 to 700 do
- begin
- write(' ');
- delay(3);
- end;
- end;
- END;
- end;
- //PROGRAMA PRINCIPAL//
- begin
- gotoxy(1,1);
- colortext:=7;
- colorback:=1;
- repeat
- cor_fundo(colorback);
- textcolor(colortext);
- menu(0,23,2,colortext);
- gotoxy(23,9);
- write('Digite a opção-> ');
- read(op);
- case op of
- 1:begin
- Repeat
- clrscr;
- menu(1,23,2,colortext);
- gotoxy(23,9);
- write('Digite a opção-> ');
- read(op1);
- case op1 of
- 1:begin
- clrscr;
- cod_cores;
- writeln;
- writeln('Insira o valor da cor a alterar-> ');
- readln(colortext);
- textcolor(colortext);
- end;
- 2:begin
- clrscr;
- cod_cores;
- writeln;
- writeln('Insira o valor da cor a alterar-> ');
- read(colorback);
- cor_fundo(colorback);
- gotoxy(1,1);
- end;
- 3:begin
- clrscr;
- muda_cores;
- textbackground(colorback);
- end;
- end;
- Until op1=0;
- end;
- 2:begin
- writeln('Insira as horas: ');
- readln(h);
- writeln('Insira os minutos: ');
- readln(m);
- writeln('Insira os segundos: ');
- readln(s);
- clrscr;
- temporizador(h,m,s);
- end;
- 3: begin
- clrscr;
- cronometro;
- writeln;
- writeln('Para parar pressione qualquer tecla');
- end;
- end;
- clrscr;
- until op=0;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement