#include<stdio.h>
void delcharfun(char str[],char ch);
main()
{
char str[100],ch;
int i;
printf("Please input the string:");
scanf("%s",str);
printf("Please input the letter you want to delete:");
scanf("%c",&ch);
printf("The result is:");
delcharfun(str,ch);
return 0;
}
void delcharfun(char str[],char ch)
{
int i,j;
for(i=0;i!='\0';i++)
{
if(str[i]==ch)
{
for(j=i;j!='\0';j++)
{
str[i]=str[i+1];
}
}
}
for(i=0;str[i]!='\0';i++)
{
printf("%c",str[i]);
}
printf("\n");
}
void delcharfun(char str[],char ch);
main()
{
char str[100],ch;
int i;
printf("Please input the string:");
scanf("%s",str);
printf("Please input the letter you want to delete:");
scanf("%c",&ch);
printf("The result is:");
delcharfun(str,ch);
return 0;
}
void delcharfun(char str[],char ch)
{
int i,j;
for(i=0;i!='\0';i++)
{
if(str[i]==ch)
{
for(j=i;j!='\0';j++)
{
str[i]=str[i+1];
}
}
}
for(i=0;str[i]!='\0';i++)
{
printf("%c",str[i]);
}
printf("\n");
}