0
What is missing from my code? đ
Determine the number of words in a phrase. https://code.sololearn.com/cfe9uD0T7o21/?ref=app
5 Answers
0
Miriam Rosaâ
1) You have cycle wich runs until i less then lenth of the phrase.
2) Inside of cycle you are adding whitespase to the string which will increase lenth of this string.
3) if uses phrase1[i] which should give you char not string
4) you are using 'and' instead && in if, I am not sure it will work in cpp
1 and 2 will work really badly together
+ 2
Remove most of those blank spaces and it works...
0
Miriam Rosaâ
I think sololearn compiler doesnt recognises getline(cin,phrase1); as input(no input prompt displayed by playground). If you try cin>>phrase1 at least it asks for input;
0
I took care of most of the errors, which only brought up another one. Unfortunately I dont know enough C++ to fix itđ
Perhaps Dima Makieiev will know whats up?
https://code.sololearn.com/cOTjp3yEKOsB/?ref=app