第1个回答 2013-06-10
#include "stdafx.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
void transf(char s[])
{
int i=0;
//s = NULL;
while(i<strlen(s))
{
if (isalpha(s[i]))
{
printf("%c",s[i]);
}
i++;
}
}
void main()
{
char *s;
char p[30]="";
//s = nullptr;
printf("please input a string!!\n");
gets(p);
s = p;
puts(s);
transf(s);
system("pause");
}
第2个回答 2013-06-10
#include<stdio.h>
void main()
{
void fun(char str[],char str1[]);
char str[80],str1[80];
gets(str);
fun(str,str1);
printf("%s",str1);
getchar();
}
void fun(char str[],char str1[])
{
int i,j;
for(i=0,j=0;str[i]!='\0';i++)
if(str[i]>'9'||str[i]<'0')str1[j++]=str[i];
str1[j]='\0';
}