I am somewhat surprised if I am not losing my opinion, but I swear to you, this code displays emoticons as .name values !! What is happening in the world? Until now, it seems to work only when the value is 1, something else is giving errors properly.
I understand that the code is spoiled → I do not need help with this.
#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
I
KNOW THAT THE CODE IS NECESSARY, I WANT TO KNOW WHY THAT THIS GIVES ME TO SEE FACE INSTEAD OF ERRORS
comforting. mocking
source
share