我用vc++6.0
试试
试试
#include<iostream> #include<cctype> using namespace std; void del_punct(char *str) { int i, j; for (i = j = 0; str[i] != '\0'; i++) { if (!ispunct(str[i])) { str[j++] = str[i]; } } str[j] = '\0'; } int main() { char a[30]; cin.getline(a,30); cout<<a<<endl; del_punct(a); cout<<endl; cout<<a<<endl; return 0; system("pause"); }