1. In Curses:
- What is stdscr?
- What is a pad?
- How can you write "Hello World" to stdscr?
- How can you write "Hello World" to a pad?
- How do you get information written to stdscr
or to a pad actually to appear on the user's screen?
2. Write a complete program that uses a dispatch table to implement
the following algorithm:
- The program prompts the user to enter a word. If the word
the user types matches one of the names in the dispatch table,
the corresponding function is called. Otherwise the program issues
an error message and doesn't call a function.
- The functions in the dispatch table take no arguments, and
return a float. The program prints the value of the returned
float when the function returns.
- The program runs forever. (Presumably, one of the functions
will call exit().)
- Do not write the code for any of the functions.
- Do everything in main().
- Write the code so that the dispatch table can be expanded
easily without affecting the statements used to search the table.
- Set up the dispatch table so that it associates the following
names and functions:
Name | Function
|
"quit" | do_exit()
|
"food" | do_eat()
|
"bed" | do_sleep()
|
"water" | do_swim()
|
3. Relate each of the syntactic elements of a URL to the process
of obtaining a document from a World Wide Web server. Include
an explanation of how the functions gethostbyname(), connect(),
write(), and read() would be used.
Christopher Vickery
Queens College of CUNY