home *** CD-ROM | disk | FTP | other *** search
- {Cute procedures used to demonstrate the RealToEnglish() Procedure}
-
- VAR
- DONE : BOOLEAN;
- TotPd,
- INREAL : REAL;
- OutStr : STRING;
- CqNum : WORD;
-
- CONST
- Pass1 : BOOLEAN = True;
- Name : STRING[30] = 'YOUR FIRM NAME';
- Address : STRING[30] = 'Your Address goes here';
- City : STRING[30] = 'Your City, Province, PostCode';
-
- PROCEDURE GetPayor;
- BEGIN
- OrgAttr:=33; SayAttr:=32; GetAttr:=26; EndAttr:=32; {DEMO}
- AtSay(15,2,Address);
- AtSay(15,3,City);
- AtSayGetStrLen(15,1,'',Name,30);
- AtSayGetStrLen(15,2,'',Address,30);
- AtSayGetStrLen(15,3,'',City,30);
- EndAttr:=33; TextAttr:=32; Pass1:=False;
- END;
-
- PROCEDURE ShowCheque;
- BEGIN
- SayAttr:=32; OrgAttr:=32;
- AtSay(69,3,', 19');
- AtSay( 2,4,'PAY to the');
- AtSay( 2,5,'order of...');
- GoToXY(65,1); WRITE('Cheque #',CqNum:3);
- TextAttr:=33;
- GoToXY(51,3); WRITE(NameOfMonth(MonthOfYear(SysDate)):15);
- GoToXY(66,3); WRITE(COPY(DateToDateString(SysDate),3,2):3);
- GoToXY(74,3); WRITE(COPY(DateToDateString(SysDate),7,2));
- SayAttr:=33; TextAttr:=33;
- AtSay(15,5,'John Roncalio, DBA: Blue Ribbon Software');
- GoToXY(1,7); ClrEol; SayAttr:=32;
- AtSay(5, 8,'The Bank of Liberal Overdrafts');
- AtSay(5, 9,'5555 Bay St., Toronto, Ontario');
- AtSay(41,9,'PER _______________________________');
- AtSay(2,11,'║▀ 000000║▀ ■|00123 ■■■ 004■| 00567■■■89║▀');
- GoToXY(8,11); WRITE(CqNum:3);
- IF Pass1 THEN GetPayor ELSE
- BEGIN
- AtSay(15,1,Name);
- AtSay(15,2,Address);
- AtSay(15,3,City);
- END;
- END;
-
- PROCEDURE IntroScript;
- BEGIN
- TextAttr:=112; ClrScr;
- GoToXY(32,1); WRITELN('RealToEnglish()'); WRITELN;
- WRITELN(' This procedure takes a REAL number and outputs a STRING of English words that');
- WRITELN(' represent the number. The obvious application for this is to produce cheques');
- WRITELN(' such as the shareware contribution cheque shown below:'); GoToXY(1,8);
- END;
-
- PROCEDURE PatheticPlea;
- BEGIN
- IF TotPd<45 THEN WRITELN(' You don''t believe in shareware?') ELSE
- BEGIN
- WRITELN;
- WRITELN(' THANK YOU! Your cheques totaling $',TotPd:10:2,' would be greatly appreciated by');
- WRITELN(' my family who think I should spend more time with them and less with Pascal!');
- RealToEnglish(TotPd,OutStr);
- WRITELN;
- IF TotPd>45 THEN
- BEGIN
- WRITELN(' ',OutStr);
- WRITELN(' is really too much; However we would be pleased to receive a shareware con-');
- WRITELN(' tribution of $45 for which I will send you complete source code on 5.25" disk.');
- WRITELN(' If you use these routines it is because they are obviously useful and a great');
- WRITELN(' savings of YOUR time, allowing you to spend more time with YOUR family. Please');
- WRITELN(' explain to your partner that the cheque for $45 that you are about to write to');
- WRITELN(' me is a tax deductable purchase of source code, and that it will go to feed a');
- WRITELN(' poor family and promote international goodwill. Again... thank you.');
- END
- ELSE WRITELN(' This procedure outputs the English words for any REAL number to $9,999,999.99');
- END;
- END;
-
- PROCEDURE WriteAnotherCheque;
- BEGIN
- OpenWindow(60,19,69,23,White,Green,2,'');
- AtSayGetBoolean(2,2,'End?',Done);
- CloseWindow; {done}
- END;
-