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

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

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时碰到了某个无法识别的字符编码便强制退出。

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

  1. python删除重复值所在的行数_使用python读取txt文件的内容,并删除重复的行数方法...

    注意,本文代码是使用在txt文档上,同时txt文档中的内容每一行代表的是图片的名字. #coding:utf-8 import shutil readDir = "原文件绝对路经" ...

  2. 读出test.txt文件的内容,输出最高分和最低分及相应的学号和姓名

    #include <stdio.h> #include "stdlib.h" struct student{int num;char name[20];int scor ...

  3. fckeditor php 不显示,PHP Fckeditor上传文件(或图片)中文显示为乱码的解决方法

    中文名乱码是因为: FCKeditor使用UTF-8编码, 自己机子比如是Windows系统 文件名使用的是GBK编码, 在上传中需要,改下编码,从UTF-8到GBK ==>第一个思路,转码思路 ...

  4. R语言读取csv文件,第一列列名出现乱码的解决方法

    在利用R语言读取csv文件时,第一列列名总是出现乱码,代码如下: setwd("E:\2.Model\4. Simulation") #设定文件路径 All.Soils = rea ...

  5. vb.net 输出txt文件到手机避免乱码

    @TOCvb.net 输出txt文件到手机避免乱码 代码往下看,初次使用CSDN的编辑器,感觉不错,还没熟悉 欢迎使用Markdown编辑器 你好! 这是你第一次使用 Markdown编辑器 所展示的 ...

  6. java给txt文件写入内容_java代码 如何向TXT文件写入内容?

    展开全部 向txt文件写入内容基本思路就是获得一个62616964757a686964616fe59b9ee7ad9431333337613134file对象,新建一个txt文件,打开I/O操作流,使 ...

  7. 关于Win10和win7下输出txt文件的换行问题

    关于Win10和win7下输出txt文件的换行问题 解决办法 事情经过 解决办法 如果原先用的是\n,那就换成\r\n就可以了 事情经过 用Qt做了一个数据处理工具,在win10下开发的当然也就只解决 ...

  8. C语言在读取txt类型文件中的汉字字符串出现乱码的解决办法

    题目 C语言在读取txt类型文件中的汉字字符串出现乱码的解决办法 以下是本篇文章正文内容,欢迎朋友们进行指正,一起探讨,共同进步.--来自考研路上的lwj 一.前言 当我们在练习文件这一章节时,因为需 ...

  9. python 文件写入多个参数_pandas 把数据写入txt文件每行固定写入一定数量的值方法...

    我遇到的情况是:把数据按一定的时间段提出.比如提出每天6:00-8:00的每个数据,可以这样做: # -*-coding: utf-8 -*- import pandas as pd import d ...

最新文章

  1. windows 2012 nps配置
  2. vue中create 什么触发_vue中eventbus被多次触发(vue中使用eventbus踩过的坑)
  3. OpenCV图像剪切的扩展和高级用法:任意裁剪,边界扩充
  4. 查看hive中某个表中的数据、表结构及所在路径
  5. 黑马程序员-------------(十)Java基础知识加强(一)
  6. Android之通过用户名和密码连接指定wifi热点(兼容Android9.0和Android10.0和addNetwork(wifiNewConfiguration)返回-1问题)
  7. LNMP详解(十二)——Nginx URL重写实战
  8. Office LTSC 2021 for Mac
  9. 第0期-前言-学习软件测试是否需要培训
  10. 计算机的硬盘配额如何更改,磁盘配额怎么设置
  11. 组合数 Counting Arrays
  12. Qt获取当前控件所在窗口的位置(坐标)
  13. eclipse 是用来写客户端的,MyEclipse 是用来写服务器端的,谐音记忆法,My 买,买服务器这样就好记了。
  14. 3.23期货品种每日早盘建议
  15. 西游记中的袁守诚的真实身份是谁?为何能知玉帝谕旨?
  16. java怎么求平方怎么求指数?
  17. 2021中考成绩查询高考,2021年中考成绩公布时间
  18. 线代9讲_特征值与特征向量相似理论
  19. 碰撞检测中的K_DOPS算法的研究
  20. JavaScript脚本的学习

热门文章

  1. 物联网核心技术M2M的构成、基本特征和应用类别
  2. python语音播报天气预报_Python3爬虫之自动查询天气并实现语音播报
  3. java tess4j 示例_java 使用tess4j实现OCR的最简单样例
  4. linux sysctl常见用法
  5. Linux pxe 安装
  6. Xshell的Sessions存放目录
  7. Hashtable使用
  8. 如何获得免费虚拟主机,云服务器呢?(免费)
  9. 普通文本el-tootip超出宽度自动显示省略号,悬停显示
  10. kubectl常用命令大全详解