mercredi 28 janvier 2015

Unexpected compilation error


I wrote this. doesn't matter what am I supposed to do with this. It just doesn't complie! Using G++ 4.9



#include <iostream>
#include <set>
#include <string>
using namespace std;

struct data {
string s;
int x, y;
};

int main() {

int n;
cin >> n;

set <data> Set;
for (int i = 0; i < n; i++) {
data temp;
cin >> temp.s >> temp.x >> temp.y;
Set.insert(temp);
}
// Prints the size
cout << Set.size() << endl;

int cnt = 0;
set <data> :: iterator it;
for (it = Set.begin(); it != Set.end(); ++it)
cout << (*it).s << (++cnt % 5 ? " " : "\n");

return 0;
}




Aucun commentaire:

Enregistrer un commentaire