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 #include using namespace std;

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!