well my friends I tried to solve a problem and it was about allowing the user to enter a paragraph , then the compiler'll count and display the number of typed words .
welll I easily solved it like this
--------------------------------------------------
#include<iostream>
#include<string>
using namespace std;
void main()
{
int words=0;
string str;
getline(cin,str);
for(int i=0;i<(int)str.length();i++)
if(isspace(str[i]))
words++;
cout<<"number of typed words is: "<<words+1<<endl;
}
-----------------------------------------------------------------------------------
but later I relized that it was very weak program
coz some users use tabs just move the pointing crosser
things like these
so who has a better idea ?