I before E except after C: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add BASIC) |
Not a robot (talk | contribs) (Add PL/I) |
||
Line 2,830: | Line 2,830: | ||
E before I when after C: is not plausible |
E before I when after C: is not plausible |
||
Overall rule is not plausible</pre> |
Overall rule is not plausible</pre> |
||
=={{header|PL/I}}== |
|||
<lang pli>iBeforeE: procedure options(main); |
|||
declare dict file; |
|||
open file(dict) title('unixdict.txt'); |
|||
on endfile(dict) go to report; |
|||
declare (cie, xie, cei, xei) fixed; |
|||
declare word char(32) varying; |
|||
cie = 0; |
|||
xie = 0; |
|||
cei = 0; |
|||
xei = 0; |
|||
do while('1'b); |
|||
get file(dict) list(word); |
|||
if index(word, 'ie') ^= 0 then |
|||
if index(word, 'cie') ^= 0 then |
|||
cie = cie + 1; |
|||
else |
|||
xie = xie + 1; |
|||
if index(word, 'ei') ^= 0 then |
|||
if index(word, 'cei') ^= 0 then |
|||
cei = cei + 1; |
|||
else |
|||
xei = xei + 1; |
|||
end; |
|||
report: |
|||
close file(dict); |
|||
put skip list('CIE:', cie); |
|||
put skip list('xIE:', xie); |
|||
put skip list('CEI:', cei); |
|||
put skip list('xEI:', xei); |
|||
declare (ieNotC, eiC) bit; |
|||
ieNotC = xie * 2 > cie; |
|||
eiC = cei * 2 > xei; |
|||
put skip list('I before E when not preceded by C:'); |
|||
if ^ieNotC then put list('not'); |
|||
put list('plausible.'); |
|||
put skip list('E before I when preceded by C:'); |
|||
if ^eiC then put list('not'); |
|||
put list('plausible.'); |
|||
put skip list('I before E, except after C:'); |
|||
if ^(ieNotC & eiC) then put list('not'); |
|||
put list('plausible.'); |
|||
end iBeforeE;</lang> |
|||
{{out}} |
|||
<pre>CIE: 24 |
|||
xIE: 465 |
|||
CEI: 13 |
|||
xEI: 213 |
|||
I before E when not preceded by C: plausible. |
|||
E before I when preceded by C: not plausible. |
|||
I before E, except after C: not plausible.</pre> |
|||
=={{header|PowerShell}}== |
=={{header|PowerShell}}== |