注册 登录
编程论坛 C++教室

大家帮忙看看,错在哪里,编译不通过!

zoo008 发布于 2010-08-26 16:56, 409 次点击
#include <iostream>
using namespace std;
int main()
{
string s("Hello World!!");
string::size_type punct_cnt=0;
for (string::size_type index=0;index!=s.size();++index)
{
  if (ispunct(s[index]))
   ++punct_cnt;
}
cout <<punct_cnt
   <<" punctuation characters in"
   <<s
   <<endl;
return 0;
}
2 回复
#2
lintaoyn2010-08-26 17:10
补上string的头文件。
#include<iostream>
#include<string>
using namespace std;
#3
zxh_852010-08-29 11:07
楼上正解
1