Tips for heathy life

Tips for heathy life

Minggu, 02 November 2008

How make display date in pascal?


I want to share program that display date in Pascal. You can use this code but if you copy this code and paste in your blog/website, please insert this link of article.

Date Programme (input,output);

uses wincrt;
const
teks='Input date on mm dd yy(0 0 0 to stop)';
typestring=string[20];
arraytipestring=array[1..12] of tipestring;
var
month,day,year:integer;
outputdate:tipestring;
namemonth:arraytipestring;
Procedure displaynamemonth(var namemonth:arraytipestring);

begin
namemonth[1] :='Januari';
namemonth[2] :='Februari';
namemonth[3] :='Maret';
namemonth[4] :='April';
namemonth[5] :='Mei';
namemonth[6] :='Juni';
namemonth[7] :='Juli';
namemonth[8] :='Agustus';
namemonth[9] :='September';
namemonth[10] :='Oktober';
namemonth[11] :='November';
namemonth[12] :='Desember';
end;

Function DateConvert(M,D,Y:integer):

typestring;

var
day,year:tipestring;

begin
str(D,Day);
str(Y:2,year);
if year[1]:=' ' then year[1]:='0';
year:='19' + year;
if (m>=1) and (m<=12) then
DateConvert:=namemonth[M] + day + ' ' + year
else
DateConvert:='Wrong Date';
end;

Begin
displaynamemonth(namemonth);
write(teks);
readln(month,day,year);
while month and day <> 0 do
begin
resultdate:= DateConvert (month,day,year);
writeln('date numeric = ',month:3,day:3,year:3);
writeln('alpha numeric = ',hasildate);
write(teks);
readln(month,day,year);
end.

0 komentar:

Posting Komentar