编程题

完善程序:(数字删除)下面程序的功能是将字符串中的数字字符删除后输出。请填空。(每空3分, 共12分)


#include

using namespace std;


int delnum(char *s) {

\tint i, j;

\tj = 0;

\tfor (i = 0; s[i] != '\\0'; i )

\t\tif (s[i] < '0' (1) s[i] > '9') {

\t\t\ts[j] = s[i];

\t\t (2) ;

\t\t}

\treturn (3) ;

}


const int SIZE = 30;


int main() {

\tchar s[SIZE];

\tint len, i;

\tcin.getline(s, sizeof(s));

\tlen = delnum(s);

\tfor (i = 0; i < len; i )

\t\tcout << (4) ;

\t\tcout << endl;

\treturn 0;

}

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论