Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Mad-Libs/Seed7/mad-libs.seed7
Normal file
31
Task/Mad-Libs/Seed7/mad-libs.seed7
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
$ include "seed7_05.s7i";
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var string: story is "";
|
||||
var string: line is "";
|
||||
var integer: pos1 is 0;
|
||||
var integer: pos2 is 1;
|
||||
var string: field is "";
|
||||
begin
|
||||
writeln("Enter a story template, terminated by an empty line:");
|
||||
repeat
|
||||
readln(line);
|
||||
if line <> "" then
|
||||
story &:= line & "\n";
|
||||
end if;
|
||||
until line = "";
|
||||
pos1 := pos(story, '<');
|
||||
while pos1 <> 0 and pos2 <> 0 do
|
||||
pos2 := pos(story, '>', pos1);
|
||||
if pos2 <> 0 then
|
||||
field := story[pos1 .. pos2];
|
||||
write("Enter a value for " <& field <& ": ");
|
||||
story := replace(story, field, getln(IN));
|
||||
pos1 := pos(story, '<', pos1);
|
||||
end if;
|
||||
end while;
|
||||
writeln;
|
||||
writeln("The story becomes:");
|
||||
write(story);
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue