Help with count & strings
Posted on 2003-03-26
I am writing a program that counts the amount of times a word appears in phrase.
Can anyone help me with this program, It runs but does not count the amount of times a word appears in a phrase.
Var phrase, word : String;
C, I: Integer;
Write('Enter a phrase : ');
Write('Enter a word :');
C := 0;
For I := 1 To Length (phrase) Do
If phrase [I] = word Then C := C+1;
Writeln('The word " '+word+' " In phrase " '+phrase+' " ',C,' Times.');