C++无法输出txt文件全部内容以及输出出现乱码的解决方法

   在做数据结构的大作业时,发现在输出某篇文章时输出到某个位置就强制中止了,后面的代码也无法正常执行。

  以下是代码和文本原文,出现问题的部分已经标记出来了。

The orange is the fruit of various citrus species in the family Rutaceae (see list of plants known as orange); it primarily refers to Citrus × sinensis, which is also called sweet orange, to distinguish it from the related Citrus × aurantium, referred to as bitter orange. The sweet orange reproduces asexually (apomixis through nucellar embryony); varieties of sweet orange arise through mutations.

The orange is a hybrid between pomelo (Citrus maxima) and mandarin (Citrus reticulata). The chloroplast genome, and therefore the maternal line, is that of pomelo. The sweet orange has had its full genome sequenced.

The orange originated in a region encompassing Southern China, Northeast India, and Myanmar,[8][9] and the earliest mention of the sweet orange was in Chinese literature in 314 BC. As of 1987, orange trees were found to be the most cultivated fruit tree in the world. Orange trees are widely grown in tropical and subtropical climates for their sweet fruit. The fruit of the orange tree can be eaten fresh, or processed for its juice or fragrant peel. As of 2012, sweet oranges accounted for approximately 70% of citrus production.

In 2019, 79 million tonnes of oranges were grown worldwide, with Brazil producing 22% of the total, followed by China and India.

Taxonomy and terminology
Main article: Citrus taxonomy
All citrus trees belong to the single genus Citrus and remain almost entirely interfertile. This includes grapefruits, lemons, limes, oranges, and various other types and hybrids. As the interfertility of oranges and other citrus has produced numerous hybrids and cultivars, and bud mutations have also been selected, citrus taxonomy is fairly controversial, confusing or inconsistent.[12][14] The fruit of any citrus tree is considered a hesperidium, a kind of modified berry; it is covered by a rind originated by a rugged thickening of the ovary wall.

Different names have been given to the many varieties of the species. Orange applies primarily to the sweet orange – Citrus sinensis (L.) Osbeck. The orange tree is an evergreen, flowering tree, with an average height of 9 to 10 m (30 to 33 ft), although some very old specimens can reach 15 m (49 ft). Its oval leaves, alternately arranged, are 4 to 10 cm (1.6 to 3.9 in) long and have crenulate margins. Sweet oranges grow in a range of different sizes, and shapes varying from spherical to oblong. Inside and attached to the rind is a porous white tissue, the white, bitter mesocarp or albedo (pith). The orange contains a number of distinct carpels (segments) inside, typically about ten, each delimited by a membrane, and containing many juice-filled vesicles and usually a few seeds (pips). When unripe, the fruit is green. The grainy irregular rind of the ripe fruit can range from bright orange to yellow-orange, but frequently retains green patches or, under warm climate conditions, remains entirely green. Like all other citrus fruits, the sweet orange is non-climacteric. The Citrus sinensis group is subdivided into four classes with distinct characteristics: common oranges, blood or pigmented oranges, navel oranges, and acidless oranges.

Other citrus groups also known as oranges are:

Mandarin orange (Citrus reticulata) is an original species of citrus, and is a progenitor of the common orange.
Bitter orange (Citrus aurantium), also known as Seville orange, sour orange (especially when used as rootstock for a sweet orange tree), bigarade orange and marmalade orange. Like the sweet orange, it is a pomelo x mandarin hybrid, but arose from a distinct hybridization event.
Bergamot orange (Citrus bergamia Risso), grown mainly in Italy for its peel, producing a primary essence for perfumes, also used to flavor Earl Grey tea. It is a hybrid of bitter orange x lemon.
Trifoliate orange (Poncirus trifoliata), sometimes included in the genus (classified as Citrus trifoliata). It often serves as a rootstock for sweet orange trees and other Citrus cultivars.

An enormous number of cultivars have, like the sweet orange, a mix of pomelo and mandarin ancestry. Some cultivars are mandarin-pomelo hybrids, bred from the same parents as the sweet orange (e.g. the tangor and ponkan tangerine). Other cultivars are sweet orange x mandarin hybrids (e.g. clementines). Mandarin traits generally include being smaller and oblate, easier to peel, and less acidic. Pomelo traits include a thick white albedo (rind pith, mesocarp) that is more closely attached to the segments.

Orange trees generally are grafted. The bottom of the tree, including the roots and trunk, is called rootstock, while the fruit-bearing top has two different names: budwood (when referring to the process of grafting) and scion (when mentioning the variety of orange).

History

Yellow Oranges and Green Tangerines by Zhao Lingrang, Chinese fan painting from the Song dynasty (NPM)
The sweet orange is not a wild fruit,[17] having arisen in domestication from a cross between a non-pure mandarin orange and a hybrid pomelo that had a substantial mandarin component. Since its chloroplast DNA is that of pomelo, it was likely the hybrid pomelo, perhaps a BC1 pomelo backcross, that was the maternal parent of the first orange.[7][40] Based on genomic analysis, the relative proportions of the ancestral species in the sweet orange is approximately 42% pomelo and 58% mandarin. All varieties of the sweet orange descend from this original cross, differing only by mutations selected for during agricultural propagation.[40] Sweet oranges have a distinct origin from the bitter orange, which arose independently, perhaps in the wild, from a cross between pure mandarin and pomelo parents. The earliest mention of the sweet orange in Chinese literature dates from 314 B.C.

In Europe, the Moors introduced the orange to the Iberian Peninsula which was known as Al-Andalus, with large scale cultivation starting in the 10th century as evidenced by complex irrigation techniques specifically adapted to support orange orchards. Citrus fruits — among them the bitter orange — were introduced to Sicily in the 9th century during the period of the Emirate of Sicily, but the sweet orange was unknown until the late 15th century or the beginnings of the 16th century, when Italian and Portuguese merchants brought orange trees into the Mediterranean area. Shortly afterward, the sweet orange quickly was adopted as an edible fruit. It also was considered a luxury item and wealthy people grew oranges in private conservatories, called orangeries. By 1646, the sweet orange was well known throughout Europe. Louis XIV of France had a great love of orange trees, and built the grandest of all royal Orangeries at the Palace of Versailles. At Versailles potted orange trees in solid silver tubs were placed throughout the rooms of the palace, while the Orangerie allowed year-round cultivation of the fruit to supply the court. When Louis condemned his finance minister, Nicolas Fouquet, in 1664, part of the treasures which he confiscated were over 1,000 orange trees from Fouquet's estate at Vaux-le-Vicomte.

Spanish travelers introduced the sweet orange into the American continent. On his second voyage in 1493, Christopher Columbus may have planted the fruit in Hispaniola. Subsequent expeditions in the mid-1500s brought sweet oranges to South America and Mexico, and to Florida in 1565, when Pedro Menéndez de Avilés founded St Augustine. Spanish missionaries brought orange trees to Arizona between 1707 and 1710, while the Franciscans did the same in San Diego, California, in 1769. An orchard was planted at the San Gabriel Mission around 1804 and a commercial orchard was established in 1841 near present-day Los Angeles. In Louisiana, oranges were probably introduced by French explorers.

Archibald Menzies, the botanist and naturalist on the Vancouver Expedition, collected orange seeds in South Africa, raised the seedlings onboard and gave them to several Hawaiian chiefs in 1792. Eventually, the sweet orange was grown in wide areas of the Hawaiian Islands, but its cultivation stopped after the arrival of the Mediterranean fruit fly in the early 1900s.

As oranges are rich in vitamin C and do not spoil easily, during the Age of Discovery, Portuguese, Spanish, and Dutch sailors planted citrus trees along trade routes to prevent scurvy.

Florida farmers obtained seeds from New Orleans around 1872, after which orange groves were established by grafting the sweet orange on to sour orange rootstocks.

Nutritional value and phytochemicals
Orange flesh is 87% water, 12% carbohydrates, 1% protein, and contains negligible fat (table). In a 100 gram reference amount, orange flesh provides 47 calories, and is a rich source of vitamin C, providing 64% of the Daily Value. No other micronutrients are present in significant amounts (table).

Oranges contain diverse phytochemicals, including carotenoids (beta-carotene, lutein and beta-cryptoxanthin), flavonoids (e.g. naringenin) and numerous volatile organic compounds producing orange aroma, including aldehydes, esters, terpenes, alcohols, and ketones.
Orange squeezer for making juice
Orange juice contains only about one-fifth the citric acid of lime or lemon juice 
 

代码和控制台输出

   

解决过程

   一开始我以为是读取txt的时候出现的问题,直到我试着通过str.length()去看看是不是拼接字符串时出现的问题时,发现并不是读取而是打印输出时出现的问题(拼接后的字符串长度与给定txt文件的长度是一致的,说明txt文件的读取和字符串的存取都是没问题的。)那么问题只可能是在cout即输出到控制台的过程中,程序碰到了某种错误而强制退出。

   我试想着是不是缓冲区溢出,超出了上限导致无法输出。但这篇文章只有9000多字,很明显不是这个问题。

   直到我先去解决控制台显示乱码问题时,发现只需要把txt文件的编码格式从UTF-8改为ANSI即可正常输出,同时打印的字符串也不会出现乱码。这里推测是因为原本txt的编码格式为UTF-8,而vs在cout时碰到了某个无法识别的字符编码便强制退出。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/46050.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

解决vscode终端信息太长,输出不全

我遇到的问题 vscode终端只显示一部分内容,显示不全 原因:vscode默认设置最多能显示1000行,超出就不显示了 解决办法: 点击vscode左下角 点击setting, 输入terminal, 找到这一栏,把数字稍微改大一些&…

Pycharm输出窗口有省略号,数据显示不全解决方法(转载)

一、借助pandas库来控制窗口的显示: import pandas as pd pd.set_option(display.max_rows, 500) pd.set_option(display.max_columns, 100) pd.set_option(display.width, 1000) 在要输出数据之前按如上方式设置, display.max_rows’是设置输出窗口显示…

Vscode 终端显示的输出结果不全

搜索 Integrated: Scrollback 将 Integrated: Scrollback 这个值增大即可

币圈变天,玩家纷纷抛售风险资产 “波米诺骨牌”已经开启

由于FTX的崩溃打击了投资者对数字资产的信心,加密货币市场在过去一周就损失了约2000 亿美元的价值。比特币 ( BTC ) 在7 天内下跌了 22%,分析师们正争先恐后地评估数字资产市场的前景,以及可能产生的政策影响。 FTX爆雷事件使得金融市场对中心…

STO不会火,比特大陆不会死,币安会去非洲:区块链行业的63个预测

翻译 | 贾瑞婷 编辑 | 波波 有句话是这么讲的:凡是杀不死你的,必定能让你更强大。 比特币大神哈尔芬尼也是这么看比特币的。 作为资深密码朋克、中本聪之外第一个接触比特币的人、传说中同中本聪交集最多的一个人,哈尔芬尼的观点在某种程度上…

BNB、HT、OKB全面估值分析——平台币还能涨多少倍?

本文采用市盈率相对估值、费雪方程式模型和折现现金流三套估值方法为三大平台币划出当前合理的价格区间。 资深分析师 | 李雪婷 运营 | 盖遥 编辑 | 郝方舟 出品 | Odaily星球日报研究院(ID:Odaily-research) 一年前,“乱入者”…

NFT 的洗盘交易,真的赚钱吗?

Nov. 17,Hanson Data Source: Footprint Analytics Wash Trade Analysis 洗盘交易造成的虚假交易是准确评估 NFT 项目、交易所和整个行业的最大障碍之一。 这份报告将会分析X2Y2市场的洗盘交易者如何从洗盘交易和代币质押中获励。同时分析了前10交易量…

108斤到90斤,我在减肥路上遇到的宝藏健身博主

点击上方蓝色字体,关注我们~ 这是一篇很早就想写的总结文,或者也可以叫安利帖。 首先宣布一件大事:我终于在有生之年,减!肥!成!功!过!了! 对的,成…

实验02 使用网络模拟器packet Tracer实验报告

这个格式可能有点问题,文档下载地址:https://download.csdn.net/download/mariodf/20203327?spm1001.2014.3001.5503 一、实验名称 使用网络模拟器Packet Tracer 二、实验目的: 1. 掌握安装和配置网络模拟器Packet Tracer的方法&#xf…

电子邮箱如何大量发送邮件?TOM VIP邮箱邮件群发的建议

明确了要做邮件营销,却不知从何入手?这是很多人业务拓展人士所遇到的问题。下面由从业多年的TOM VIP邮箱为大家分享下~ 首先,在邮件群发时品牌怎么选? 影响群发效果的几个关键因素,发信数量、发信通道、频率、ip、内…

邮件群发软件哪个好用?

后疫情时代,邮件在我们的工作、生活中扮演越来越重要的角色。无论是用户交流、身份认证还是资料传输,都离不开邮件。因此有人使用群发邮件来扩展公司的业务,收到了不小成效,所以邮件群发也是我们在和客户交流时必备的技能。 在邮…

分享邮件营销群发的6大技巧!怎么群发邮件效果好?

新的一年想要大展宏“兔”,首先要有可以提高工作消息的工具—邮箱。目前有小部分企业会进行邮件营销,邮件营销的重中之中是邮件群发!怎么做邮件营销群发推广?分享邮件营销群发的6大技巧! 邮件群发信息时还在手敲&#…

新人进群发邮件软件,QQ群潜伏发邮件软件,一进群就收到邮件软件

一、QQ群监控介绍: 什么是QQ群监控?简而言之,只要我的号在里面,我就能获取到我所加入的这些群,什么时候有新成员进入,一旦有新成员进入,立即推送广告过去,因为客户只有在想了解某样…

外贸公司怎么群发邮件?群发邮件邮箱怎么发更高效?

最近跟小妹聊天,小妹说她在老家把铁饭碗给辞了,想去北京打拼。我说挺好的呀,支持你。然后小妹就跟我说我妈不支持我去北京上班,其实这个事情一出,我妈就非常生气了,就不同意我去北京打拼。 结束聊天后&…

批量导入邮箱:收发邮件/群发邮件

批量导入邮箱:收发邮件/群发邮件 如果你有大量邮箱需管理 如果你需要批量登陆大量邮箱收取邮件 如果你需要批量登陆大量邮箱群发邮件 那么请往下看 一、批量导入邮箱(文本导入) 参照《邮箱管理》,打开界面>>选择“导入/导出…

怎么群发邮件,群发邮件怎么发,哪个邮箱好?

大家好哦,本期分享关于怎么群发邮件,群发邮件怎么发,哪个邮箱好等相关内容,具体如何发信的技巧,让我们一起来看下吧!首先群发前,我们需要先了解收件人、抄送、密送、群发单显的关系。 收件人&a…

如何利用Gmail群发电子邮件

并非每个人都有投资电子邮件营销软件的预算。 但是,是否有任何解决方案可以通过 Gmail 发送大量电子邮件(或 批量电子邮件 )? 值得庆幸的是,有。 您可以通过以下 2 种方式使用 Gmail 快速免费地发送群发电子邮件。 …

群发邮箱软件哪个好?邮箱群发平台哪个好用?

日常使用邮箱办公的人员,经常会用到群发这个功能,群发邮件给客户、给同事,对于群发邮件来说,群发的数量应该是在首位的,其次就是群发是否可以正常的收到邮件,根据这两点,就可以判断出群发邮箱和…

群发邮件软件怎么发,教你邮箱群发邮件小技巧

有时候真的感觉时间过得挺快的,一转眼一年的时间就要过去了,看着旁边的同事正在熟练的编辑邮件准备群发,就不仅感叹只要是在工作中付出努力的,在最后都会因为曾经所付出的努力而收获相应的回报,获得别人不可能得到的收…

个人邮箱如何进行群发邮件?

越来越多的人开始使用邮箱来进行营销,那么首先使用邮箱来进行营销时,最重要的一个功能就是群发邮件,与之相对应的就是群发单显,那么TomVIP个人邮箱在使用时,这些功能对邮件营销有什么帮助呢?今天小编来帮你…