Question: How Can I complete this question to get how many words the user entered ? #include #include using namespace std; int main() { string str;
How Can I complete this question to get how many words the user entered ?
#include
int main() { string str; int pos, words;
..... // end of variable declaration cout<< " please enter a Sentence: "< pos = str.find(' ', pos+1); if (pos>0) { ........... words++; } else empty=true; //End If while(pos>=0 && !empty) { ........ ......... } //End While cout << " This Sentence has " << words << " words"< }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
