Arithmetic/Rational/Modula-2: Difference between revisions
Content added Content deleted
mNo edit summary |
m (prepare for inclusion as template) |
||
Line 1: | Line 1: | ||
{{collection|Rational Arithmetic}} |
<noinclude>{{collection|Rational Arithmetic}}</noinclude> |
||
{{works with|FST Modula-2 v4.0|no object oriented code used}} |
{{works with|FST Modula-2 v4.0|no object oriented code used}} |
||
This is incomplete as the Perfect Numbers task has not been addressed. |
This is incomplete as the Perfect Numbers task has not been addressed. |
||
Definition Module |
;Definition Module |
||
<lang modula2>DEFINITION MODULE Rational; |
<lang modula2>DEFINITION MODULE Rational; |
||
TYPE RAT = RECORD |
TYPE RAT = RECORD |
||
Line 46: | Line 46: | ||
END Rational.</lang> |
END Rational.</lang> |
||
Implementation Module |
;Implementation Module |
||
<lang modula2>IMPLEMENTATION MODULE Rational; |
<lang modula2>IMPLEMENTATION MODULE Rational; |
||
Line 269: | Line 269: | ||
END WriteRational; |
END WriteRational; |
||
END Rational. |
END Rational.</lang> |
||
</lang> |
|||
Test Program |
;Test Program |
||
<lang modula2>MODULE TestRat; |
<lang modula2>MODULE TestRat; |
||
FROM InOut IMPORT WriteString, WriteLine; |
FROM InOut IMPORT WriteString, WriteLine; |