🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.misc
1 messages
1 total messages Started by frachan Sun, 12 Mar 2000 00:00
Pascal Help!!!
#2208
Author: frachan
Date: Sun, 12 Mar 2000 00:00
97 lines
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

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads