识别英文单词时,没能考虑标点,怎么改?

#include
#include
#include
#include

bool isdigit(char ch)
{
return (ch>=' '&&ch<='9');
}

using namespace std;

int main(void)
{
map words;
ifstream fin("a.txt");//a是要统计的文件
ofstream fout("b.txt");//结果存放在b中
string str;
int count=0;

if(!fin || !fout)
{
    cout<<"open failed!"<<endl;
    exit(1);
}
while(fin.good())
{
    fin>>str;
    words[str]++;
}
fin.close();
for(map<string,int>::iterator mit=words.begin();mit!=words.end();++mit)
{
    if(!isdigit((mit->first)[0]))
    {
        fout<<mit->first<<": "<<mit->second<<endl;
        ++count;
    }
}
fout<<"total: "<<count<<endl;
fout.close();
return 0;

}

bool isdigit(char ch)
{
return (ch>=' '&&ch<='9');
}
在这里加个点表的判断

while(fin.good())
{
fin>>str;
std::remove_if (str.begin (), str.end (), std::ispunct)
words[str]++;
}

头文件:
std::remove_if -> algorithm
std::ispunct -> cctype

另外,ccypte里面有isdigit函数,没必要自己写