求c语言高手,,,在线等,,,谢谢各位。。急急急~~!!!!

2024-12-15 16:57:07
推荐回答(1个)
回答1:

#include

int trans(char *str, char ch)
{
int i, change=0;
if(str==NULL)
return 1;
for(i=0;str[i]!='\0';i++)
{
if(change==1)
str[i]=str[i]+'A'-'a';
else if(str[i]==ch)
change=1;
}
return 0;
}
int main()
{
char str[100];
char c;
scanf("%c", &c);
scanf("%s", str);
if(trans(str, c)!=0)
printf("trans failed\n");
return 0;
}