gpt4 book ai didi

c++ - 如何反转文件中行的顺序

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:38:42 27 4
gpt4 key购买 nike

<分区>

我们怎么能尊重文件中行的顺序而不是行本身。文件会变得很大。

不应对直线的长度做出任何假设。

输入:

this is line1
this is line2
this is line3

示例输出:

this is line3
this is line2
this is line1

我虽然考虑过使用另一个文件作为缓冲区,例如堆栈数据结构,但实际上无处可去。

对此有什么想法吗?

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com