Article View: news.software.misc
Article #2208Pascal Help!!!
From: frachan
Date: Sun, 12 Mar 2000 00:00
Date: Sun, 12 Mar 2000 00:00
97 lines
2881 bytes
2881 bytes
During my pascal language is not very well. Please help to
fix the following software bug. Thanks a million!!!
program test;
uses Crt,dos;
type
time=record
hour, minute, second: String
end;
var c,d:char;
h,m,s,hund:word;
function LeadingZero(w : Word) : String;
var
s : String;
begin
Str(w:0,s);
if Length(s) = 1 then
s := '0' + s;
LeadingZero := s;
end;
procedure set_time(var t:time; hr, min, sec:String);
begin
t.hour:=LeadingZero(hr);
t.minute:=LeadingZer(min);
t.second:=LeadingZero(sec);
end;
procedure inc_min (var t:time; min:String);
begin
writeln('Input how many mintue(s) wanted to
increase?');
readln(min);
t.minute:=t.minute+min
end;
procedure dec_min (var t:time; min:String);
begin
writeln('Input how many minute(s) wanted to
decrease?');
readln(min);
t.minute:=t.minute-min
end;
procedure print_time (t:time);
var ampm:string;
begin
clrscr;
GotoXy(1,1);
if t.hour <= 11 then
begin
ampm := 'AM'
end
else
begin
ampm := 'PM';
t.hour := t.hour -12;
end
writeln(t.hour,':',t.minute,':',t.second,' ',ampm);
end;
function get_t():time;
begin
gettime(h,m,s,hund);
end;
begin
repeat
clrscr;
repeat
get_t();
set_time(time,h,m,s);
print_time(time);
writeln;
writeln;
writeln('I - Increase the clock minute(s)');
writeln('D - Decrease the clock minute(s)');
until keypressed;
c:=readkey;
case c of
'i', 'I' : inc_min(time,m);
'd', 'D' : dec_min(time,m);
end;
repeat until keypressed;
d:=readkey; {use to reset the keypressed}
until (c='q','Q');
end.
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
Technical Details
Message-ID:
<0671ec78.f566dfae@usw-ex0109-070.remarq.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.misc.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <0671ec78.f566dfae@usw-ex0109-070.remarq.com> Subject: Pascal Help!!! Date: Sun, 12 Mar 2000 00:00:00 +0000 From: frachan <frachanNOfrSPAM@sinaman.com.invalid> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.misc.mbox.zip!not-for-mail X-Deja-AN: 596709252 X-Originating-Host: 202.40.36.34 X-Complaints-To: wrenabuse@remarq.com X-Trace: WReNphoon1 952921960 10.0.2.70 (Sun, 12 Mar 2000 20:32:40 PST) Organization: http://www.remarq.com: The World's Usenet/Discussions Start Here NNTP-Posting-Date: Sun, 12 Mar 2000 20:32:40 PST X-Wren-Trace: eGhNZWR9OnA7Lm5hbiBob1pocWNsYSlwI2doZiEuIXopOngnNX4zNTA= Newsgroups: news.software.misc