这里先埋个坑(
#CP1025. 陈述句变成疑问句
还是有点小bug后面再调吧
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main()
{
char a[100];
char b[100]; //第一个单词
char c[100]; //第二个单词
char d[100]; //其余剩下的单词
int i,y,x,f,j=0,k=0,l=0;
gets(a);
f=strlen(a);
for(i=0; a[i]!='\0'; i++)
{
b[j]=a[i];
j++;
if(a[i+1]==' ')
{
break;
}
}
b[j]='\0';
if(i==f)
{
for(int t=0; t<j-1; t++)
{
printf("%c",b[t]);
}
printf("?");
return 0;
}
for( y=i+1; a[y]!='\0'; y++)
{
c[k]=a[y];
k++;
if(a[y+1]==' ')
{
break;
}
}
c[k]='\0';
if(f==y)
{
for(int t=0; t<k-1; t++)
{
if(c[t]!=' ')
{
if(t==1)
{
printf("%c",c[t]-32);
continue;
}
printf("%c",c[t]);
}
}
printf(" ");
for(int t=0; t<j; t++)
{
if(b[t]!=' ')
{
if(t==0)
{
printf("%c",b[t]+32);
continue;
}
printf("%c",b[t]);
}
}
printf("?");
return 0;
}
for( x=y+1; a[x]!='\0'; x++)
{
d[l]=a[x];
l++;
if(a[x+1]=='\0')
{
break;
}
}
d[l]='\0';
for(int t=0; t<k; t++)
{
if(c[t]!=' ')
{
if(t==1)
{
printf("%c",c[t]-32);
continue;
}
printf("%c",c[t]);
}
}
printf(" ");
for(int t=0; t<j; t++)
{
if(b[t]!=' ')
{
if(t==0)
{
printf("%c",b[t]+32);
continue;
}
printf("%c",b[t]);
}
}
for(int t=0; t<l-1; t++)
{
printf("%c",d[t]);
}
printf("?");
return 0;
}
posted on 2023-01-06 11:08 harumakigohan 阅读(16) 评论(0) 编辑 收藏 举报
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异