int main(void) { long long allocSize = 80; char *buffer = calloc(allocSize, sizeof(char)); struct person **people = calloc(1, sizeof(struct person)); int numPeople = 0; char c; while ((c = fgetc(stdin)) && !feof(stdin)){ if (c == '\n') { people = StringToAnimosity(people, &numPeople, buffer); memset(buffer, 0, allocSize); } else { buffer = AddToString(buffer, &allocSize, c); } } GetPerson(&people, &numPeople, "me"); printf("Max happiness: %ld\n", permutation(people, 0, numPeople)); return 0; }
int main() { map_uplow_bound(); FillPerson(); Person* per = GetPerson("Andy"); if (NULL != per) std::cout << "Name:" << per->name << " " << "Age:" << per->age << std::endl; std::cout << "=====================" << std::endl; ps.insert(std::make_pair("Code", 1)); ps.insert(std::make_pair("Source", 2)); ps.insert(std::make_pair("Code", 3)); typedef std::map<std::string, int>::iterator PI; PI it = ps.begin(); std::cout << "Size:" << ps.size() << std::endl; for (; it != ps.end(); ++it) { std::cout << it->first << ":" << it->second << std::endl; } return 0; }