Jump to content
Sign in to follow this  
Bajt

Vídeo-aula: Verificar que hrs são

Recommended Posts

Bajt    0
Bajt

Parte 1

 

[ame]http://www.youtube.com/watch?v=SctjeQXDJXU[/ame]

 

 

Parte 2

 

[ame]http://www.youtube.com/watch?v=OGdrNV_K558[/ame]

 

 

[spoiler=CÓDIGO COMPLETO]

unit UPrincipal;

 

interface

 

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls;

 

type

TForm1 = class(TForm)

Button1: TButton;

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

 

var

Form1: TForm1;

a:integer;

 

implementation

 

{$R *.dfm}

 

procedure TForm1.Button1Click(Sender: TObject);

begin

a:=strToInt(formatdatetime('hh',now));

if (a>=6) and (a<=12) then

begin

ShowMessage('A hora atual é '+formatdatetime('hh:mm',now)+#10+'Bom Dia!');

end

else

if (a>=12) and (a<=17) then

begin

showmessage('A hora atual é '+formatdatetime('hh:mm',now)+#10+'Boa Tarde!');

end

else

if (a>=18) and (a<=24) then

begin

showmessage('A hora atual é '+formatdatetime('hh:mm',now)+#10+'Boa Noite!');

end

else

if (a>=24) and (a<=6) then

begin

showmessage('A hora atual é '+formatdatetime('hh:mm',now)+#10+'Boa Madrugada!');

end;

end;

 

end.

 

Share this post


Link to post
Share on other sites
Eventide    7
Eventide

Bem legal cara, mas olhando o código fonte, faltou uma identação ai.. =)~

 

Obrigado pela contribuição!

Share this post


Link to post
Share on other sites
Bajt    0
Bajt

Se explicasse melhor eu agradeceria :).

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×