C language delete c or C in the string

C language delete c or C in the string

1. Enter the code and the result is as follows.

Enter some strings, the program automatically deletes c or C, and the results are as follows.
Insert picture description here

2. Source code

#include <stdio.h>
#include <string.h>
void main ()
{
    char s[100];
    gets(s);
	{
	int n,i,j;
	n=strlen(s);
	for (i=0;i<=n;i++)
	{
		if(s[i]=='c'||s[i]=='C')
		{for (j=i;j<=n;j++)
		s[j]=s[j+1];}
	}
	printf("%s\n",s);
	}
}

Guess you like

Origin blog.csdn.net/peter_young1990/article/details/115381596