我在尝试将适当的文章添加到法国国家/地区名称的开头时遇到问题。那部分不是问题,但尝试将其打印出效果不是很好。文件中有特殊字符,尽管看起来很好,但不会很好地打印出来。我正在使用Visual Studio,这是我尝试打印的文本文件“ FrenchCountriesUnfinished.txt”中的单词示例
l'Algérie, 拉诺维日, 拉泽兰德, 拉苏埃德 扎伊尔(LeZaïre)
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream file("FrenchCountriesUnfinished.txt");
string str;
while (getline(file, str)) {
cout << str << endl;
}
return 0;
}