一道编程,C++,为什么运行不了?统计字符串中字母数字以及其他字符的个数

#include
#include
#include
using namespace std;
int main()
{
string line;
cout<<"please enter a line"<<endl;
getline(cin,line);
string::size_type nLetter=0,nDigit=0,nOthers=0;
for(auto c:line)
{
if(isalpha(c))
++nLetter;
if(isdigit(c))
++nDigit;
else
++nOthers;
}
cout<<"字母有"<<nLetter<<endl;
cout<<"数字有"<<nDigit<<endl;
cout<<"其他字符有"<<nOthers<<endl;
return 0;
}


for(auto c:line)
这个要支持C++ 11的编译器才能编译

可以编译运行
在线验证地址
http://ideone.com/AaNt6P