私は心が失われているかどうか疑問に思っていますが、私はあなたに誓っています。このコードはスマイルな顔を.name値として出力します!!世界で何が起こっているのですか?これまでのところ、値が1の場合にのみ動作するように見えますが、それ以外のものは正しくエラーを出します。structプロパティに不適切な値の型を割り当てると面白い顔をしています!
私はコードに欠陥があることを認識しています - >これは助けが必要ありません。
#include <iostream>
#include <fstream>
#include <regex>
#include <string>
#include <list>
using namespace std;
using namespace tr1;
struct CollectedData
{
public:
string name;
float grade;
};
int main()
{
string line;
list<CollectedData> AllData;
int count;
ifstream myFile("test_data.txt");
if (myFile.fail()) {cout << "Error opening file"; return 0;}
else
{
cout << "File opened... \n";
while(getline(myFile, line)) {
CollectedData lineData;
lineData.name = 1;
lineData.grade = 2;
AllData.push_back(lineData);
}
}
cout << "\n\n File contents: \n";
list<CollectedData>::iterator Iterator;
for(Iterator = AllData.begin();
Iterator != AllData.end();
Iterator++)
{
cout << "\t" << (*Iterator).name << " - ";
cout << "\t" << (*Iterator).grade << "\n";
}
getchar();
return 1;
}
:-) http://img21.imageshack.us/img21/4600/capturekjc.jpg
私はCODEは無用であることを知っている、
は、私はそれがSMILEYではなく、エラー
慰めの顔MEを与えている理由を知りたいです。 。 。
そのスマイリーは0x01の文字です。 – LiraNuna
+1、それ以上の状況と小さな怒りが私を笑わせてくれました。 – Corey
コードテーブル:http://en.wikipedia.org/wiki/Code_page_437#Characters – mark4o