不会写code 2022-09-13 22:30 采纳率: 76.5%
浏览 87
已结题

将python格式转化为C语言格式

C语言怎么将一段英文遍历为每个单词
例如下面的python是这样子的,但是用C怎么表达出来

img


输入这段话
Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and supple knees; it is a matter of the will, a quality of the imagination, a vigor of the emotions; it is the freshness of the deep springs of life.

img

我想要达到的结果

用C语言写出Python这样的结果

img

  • 写回答

5条回答 默认 最新

  • 梦里逆天 2022-09-13 22:45
    关注
    #include <stdio.h>
    #include <string.h>
    
    int main()
    {
        char str[250] = "Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and supple knees; it is a matter of the will, a quality of the imagination, a vigor of the emotions; it is the freshness of the deep springs of life.";
        for(int i=0; i<strlen(str); i++)
        {
            printf("%c", str[i]);
            if(str[i] == ' ') // 遇空格换行 
                printf("\n");
        }
        return 0;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

问题事件

  • 系统已结题 9月21日
  • 已采纳回答 9月13日
  • 创建了问题 9月13日

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效