Pascal assignment , need help :(
Posted on 2003-03-26
Write a program that;
Prompts and permits the user to enter a phrase.
Prompts and permits the user to enter a word.
Reveals the number of times that the word occurs in the phrase. (N.B. Words within words do not count).
ive tried so far
word : string;
phrase : string;
i : integer;
c : integer;
write('Enter a phrase : ');
write('Enter a word : ');
for i := 1 to length(phrase) Do
if phrase[i] = word then c := c+1;
writeln('Found word "'+word+'" in phrase "'+phrase+'" ',c,' times.');