CSE 111, Fall 2000

HW #10: SUBSTRING PROCESSING

Last Update: 13 November 2000

Note: NEW material is highlighted


NEW
For each of the following problems, please turn in a copy of your program, accompanied by at least 2 sample runs with different data that test the facilities of your program.

If your program does not compile, or compiles but does not behave as expected, and you do not have time to correct it, then instead of the sample runs, you should submit a bug report.
NEW


  1. Do Biermann, p. 58, #3:
  2. Design, write, compile, and test (and debug, if necessary) a Pascal program that has the following input-output behavior:
     


  3. Do Biermann, p. 58, #4:
  4. Design, write, compile, and test (and debug, if necessary) a Pascal program that has the following
    input-output behavior:

            input:      string S, integer n
            output:    (the substring of S that consists of) the last n characters of S.
            Hint:       At which character of S does this substring begin?
                           How long is this substring?


  5. Do Biermann, p. 58, #5:
  6. Design, write, compile, and test (and debug, if necessary) a Pascal program that has the following
    input-output behavior:

           input:      two strings, S and T
           output:    If S is a substring of T, then it outputs 'yes', else it outputs 'no'
           Hint:       Use the "index" function.
                           If S is a substring of T, what is index(T, S)? (Is it positive? Negative? 0?)
                           If S is not a substring of T, then what is index(T, S)?

    NEW
    For this problem, at least one of your sample runs must test a situation in which S is a substring of T, and at least one of your sample runs must test a situtation in which S is not a substring of T.

DUE: AT THE START OF LECTURE: WED., NOV. 15


Copyright © 2000 by William J. Rapaport (rapaport@cse.buffalo.edu)

file: 111F00/hw10.13nv00.html