I would like to know how to do this exercise:
Given a sentence ending with a point in a vector, perform an algorithm that tells us how many words are the same as the first word.
I do not need the code, since we are doing it in pseudocode, but we will do C in nothing.
The fact is that I have read the vector entered by the user, then I have read the first word and I have saved it in a vector "j". Then I read word by word from the vector to compare: if v[i] == j[i]
(first word), then what cont = cont +1
.
The problem is that I do not know how to "go picking up" word by word to compare it.
I made this loop:
i = 0;
mientras (i < = 20) & (v[i] != '.') & (v[i] != ' ') hacer
si (v[i] == j[i]) entonces
cont = cont +1;
fsi
i ++;
fmientras
I do not know if what I've done is fine, but good.