#include <stdio.h>
char *fun(char *a)
{ char *b=",.:"/* 举例部分标点符号,请自行补充 */
char *temp,ch
int i
for(i=0i<strlen(b)i++){
ch=*(b+i)
temp = (char *)strchr(a,ch)
while( strlen(temp)>0){
if(strlen(temp)>0)
strcpy(temp,temp+1)
temp = (char *)strchr(a,ch)
}
}
return(a)
}
main()
{ char *a="This, is. a,try."
printf("%s\n",a)
printf("%s\n",fun(a))
}
#include<stdio.h>void main()
{
char a[100]
int i
int j=0
printf("请输入符号:\n")
scanf("%s",a)
for(i=0a[i]!=NULLi++)
{ j++
}
a[0]=' '
a[j-1]=' '
printf("删除后输出:\n%s",a)printf("\n")
}
验证过了。。能执行。。满意请采纳
下面程序只
输出大写小写及数字,去掉一切其它字符:
#include
<stdio.h>
main(){
FILE
*fin,
*fout
static
int
c
fin=fopen("abc.txt","r")
fout=fopen("abc2.txt","w")
while(1){
if
(
(c
=
fgetc(fin))==EOF)
break
if
(
(c
>=
'a'
&&
c
<=
'z')
||
(c
>=
'A'
&&
c
<=
'A')
||
(c
>=
'0'
&&
c
<=
'9')
)
fputc(c,fout)
}
fclose(fin)
fclose(fout)
}