Related to homework given . number of words

I don’t know where im doing wrong here. its giving me total no. of chars but not the no. of words

#include using namespace std; int main() { char ch; cin.get(ch); int i = 0; while (ch != ‘$’) { if(ch == ’ ’ || ‘.’ || ‘,’) { i++; } } cout << i; return 0; }

hi @navyakalikiri2000_f9691b2b68fa530b,
Please send me the pic of question