C++ Program to Count Number of Words in String

Factorial of huge numbers contain such a large number of digits. For instance factorial of 100 has just about 158 digits.

So there is no information type accessible to store such a long worth. In any case, we can discover factorial for

huge numbers utilizing straightforward augmentation strategy that we utilized in our educational time.

Underneath I have shared the program for it.


using namespace std;
int main()
	char a[100];
	int i,count=1;
	cout<<"Enter a string:";
		if(a[i]==' ')
	cout<<"\nThere are "<<count<<" words in the given string";
	return 0;


Enter a string:how are you buddy?

There are 4 words in the given string

Leave a Comment

error: Alert: Content is protected!!