Open itsshivamku opened 1 year ago
using namespace std;
int countWords(const string& input) { stringstream ss(input); string word; int count = 0;
while (ss >> word) { count++; } return count;
}
int main() { cout << "Word Count Program\n";
string input; cout << "Enter a sentence or paragraph: "; getline(cin, input); int wordCount = countWords(input); cout << "Number of words: " << wordCount << endl; return 0;
include
include
include
using namespace std;
int countWords(const string& input) { stringstream ss(input); string word; int count = 0;
}
int main() { cout << "Word Count Program\n";
}