|
Last Update: 13 November 2000
Note: material is highlighted |
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.
Design, write, compile, and test (and debug, if necessary) a Pascal
program that has the following input-output behavior:
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?
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)?
![]()
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 |