Determine sentence type: Difference between revisions

Added XPL0 example.
No edit summary
(Added XPL0 example.)
Line 816:
S <- Just make sure you (or Mrs.Smith) don't break it.
Q <- By the way, what the heck is an exclamatory question!?
</pre>
 
=={{header|XPL0}}==
<lang XPL0>include xpllib; \for StrLen
int Sentence, N, Len;
char Str;
[Sentence:= ["hi there, how are you today?",
"I'd like to present to you the washing machine 9001.",
"You have been nominated to win one of these!",
"Just make sure you don't break it"];
for N:= 0 to 3 do
[Str:= Sentence(N);
Len:= StrLen(Str);
case Str(Len-1) of
^!: ChOut(0, ^E);
^?: ChOut(0, ^Q);
^.: ChOut(0, ^S)
other ChOut(0, ^N);
if N < 3 then ChOut(0, ^|);
];
]</lang>
 
{{out}}
<pre>
Q|S|E|N
</pre>
772

edits