Index of /cse121/lecture/week07

Icon  Name                    Last modified      Size  Description
[DIR] Parent Directory - [   ] 2darray.c 12-Aug-2008 18:38 599 [   ] game.c 14-Aug-2008 20:27 1.3K [DIR] hw8/ 14-Aug-2008 22:01 - [   ] random.c 12-Aug-2008 18:43 664 [TXT] random.txt 13-Aug-2008 07:50 1.3K [TXT] sample-test2.txt 08-Aug-2008 22:28 2.9K
The game[1-3] executable files:

    abcde1234@cs:~$ cp /home/csci/mhuffman/cse121/game1 .
    abcde1234@cs:~$ cp /home/csci/mhuffman/cse121/game2 .
    abcde1234@cs:~$ cp /home/csci/mhuffman/cse121/game3 .
    
    abcde1234@cs:~/cse121$ ./game1

     - - -
     - - -
     - - -
    Enter row (1-3) and column (1-3) separated by a space: 2 3
    Choice (x / o): x

     - - -
     - - x
     - - -

------------------------------------------------------------------------------

See random.txt for some notes and thought regarding getting random numbers in
a range.

------------------------------------------------------------------------------
Open Lab

I will be in Scarpelli Hall, room 125 (SHL 125) Wednesday and Friday:
13:00 - 16:00.

Note, however, that if no one is there later than 15:00 and you have not
personally notified me that you plan to be there later, I MAY not stay.

SHL 125 is a computerized classroom with 20 work stations. You will need your
Student Login to log into the computers.

------------------------------------------------------------------------------
fgets()

From the man page for fgets:

    char *fgets(char *s, int size, FILE *stream);

    fgets() reads in at most one less than size characters from stream and
    stores them into the buffer pointed to by s.


When you modify Chapter 16 Program 16.3 to use fgets() you are reading the
user's file names from the same place that the original program read the file
names using scanf(): the terminal.

scanf() reads from the special "file" called stdin (standard input) that
is automatically opened for you as part of the startup code for all
Standard C programs.

Therefore, the "stream" in fgets() is the stdin FILE pointer.

------------------------------------------------------------------------------
rand() and srand()

If you want to use the man command for rand, use use one of the
following commands:

    man 3 rand
    man srand

------------------------------------------------------------------------------