提交记录 #340
提交时间:2024-12-02 16:33:53
语言:c
状态:Unaccepted
编译情况:编译成功
code.c: In function ‘main’:
code.c:7:5: warning: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration]
7 | gets(str);gets(strs);gets(stro);
| ^~~~
| fgets
/usr/bin/ld: /tmp/ccCbYOkQ.o: in function `main':
code.c:(.text.startup+0x111): warning: the `gets' function is dangerous and should not be used.
固定测试点#1:
固定测试点#2:
固定测试点#3:
额外测试点#50:
52【字符】字符替换*——用指针更方便
#include<stdio.h>
#include<string.h>
int main()
{
char str[100]={0},strs[100]={0},stro[100]={0},stra[100]={0};int i,j,k=0,l,count;
gets(str);gets(strs);gets(stro);
for(i=0;i<strlen(str);i++)
{
count=0;
for(j=0;j<strlen(strs);j++)
{
if(str[i+j]==strs[j])
{
count++;
}
}
if(count==strlen(strs))
{
for(l=0;l<strlen(stro);l++)
{
stra[k+l]=stro[l];
}
k=k+l;i=i+strlen(strs)-1;
}
else
{
stra[k]=str[i];k++;
}
}
puts(stra);
return 0;
}