2 ' $State$
3 ' $Revision$
-10 print "Hi there! Before we start, what is your name?"
+10 print "Hi there! I'm written in Basic. Before we start, what is your name?"
20 input "> ", PlayerName$
30 print
40 print "Hello, "; PlayerName$; "!"
int main(int argc, char* argv[])
{
- printf("\nHi there! Before we start, what is your name?\n");
+ printf("\nHi there! I'm written in C. Before we start, what is your name?\n");
reads();
strcpy(PlayerName, buffer);
printf("\nHello, %s! ", PlayerName);
finished : BOOLEAN;
BEGIN
WriteLn;
- WriteString("Hi there! Before we start, what is your name?");
+ WriteString("Hi there! I'm written in Modula-2. Before we start, what is your name?");
WriteLn;
reads;
WriteLn;
proc getname =
var seed, buffer[128]:
seq
- puts("*nHi there! Before we start, what is your name?*n")
+ puts("*nHi there! I'm written in Occam. Before we start, what is your name?*n")
puts("> ")
gets(buffer)
random := seed mod range;
end;
-{ Pascal doesn't provide string input, so we interface to the _read() syscall
- and do it manually. }
+{ Pascal doesn't provide string input, so we interface to the read() syscall
+ and do it manually. But... we can't interface to read() directly because
+ that conflicts with a Pascal keyword. Luckily there's a private function
+ uread() in the ACK Pascal library that we can use instead. }
-function _read(fd : integer; var buffer : char; count : integer) : integer;
+function uread(fd : integer; var buffer : char; count : integer) : integer;
extern;
function readchar : char;
begin
c := chr(0);
- dummy := _read(0, c, 1);
+ dummy := uread(0, c, 1);
readchar := c;
end;
begin
writeln;
- writeln('Hi there! Before we start, what is your name?');
+ writeln('Hi there! I''m written in Pascal. Before we start, what is your name?');
writeln;
readstring(name, namelen);
writeln;