如题所述
#include <stdio.h>
#include <ctype.h>
int main() {
char s[500];
int i,j;
printf("输入字符串:\n");
while(fgets(s,500,stdin)) {
for(i = 0,j = 0;s[i];++i)
if(isalpha(s[i])) s[j++] = s[i];
s[j] = '\0';
printf("%s\n输入字符串(<Ctrl+Z> <Enter> 退出):\n",s);
}
return 0;
}追问
#include <ctype.h>
int main() {
char s[500];
int i,j;
printf("输入字符串:\n");
while(fgets(s,500,stdin)) {
for(i = 0,j = 0;s[i];++i)
if(isalpha(s[i])) s[j++] = s[i];
s[j] = '\0';
printf("%s\n输入字符串(<Ctrl+Z> <Enter> 退出):\n",s);
}
return 0;
}追问
fgets stdin isalpha 是什么意思
追答fgets(s,500,stdin) // 最多读入500 - 1个字符
stdin -- standard input output
isalpha(ch) // ch是英文字符时,返回1,否则返回0
温馨提示:答案为网友推荐,仅供参考
第1个回答 2015-05-28
||⊙︿⊙追问
…
第2个回答 2015-05-28
#¥%&@,+-*/, 这些算进你的标点符号里面吗?你想要如何区分减号和连接符
第3个回答 2015-05-28
十八爸爸妈妈好
第4个回答 2015-05-28
😰追问
…