Array of Strings
|
Original Message
|
Name: igor12
Date: April 4, 2005 at 17:06:49 Pacific
Subject: Array of StringsOS: WinXPCPU/Ram: 1600/256 |
Comment: I was wondering how I could make a 2 dimensional array of strings where the values are read from an input file. The input file would be called something like "input.dat" and it would contain data like this: banco bank regalo present camiseta shirt ... and the words would need to be written to a 2D array of strings, like this: list[][] = { "banco", "regalo", "camiseta" "bank", "present", "shirt"}; and from an input file of undetermined size. This is for a dictionary. Thanks, Igor
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: Chi Happens
Date: April 5, 2005 at 09:28:49 Pacific
Subject: Array of Strings |
Reply: (edit)I am assuming this is c++? if so, I suggest using a class that holds the pair in a linked list or queue. Hope this helps, Chi They mostly come at night...mostly
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: InfiniteRecursion
Date: April 5, 2005 at 12:27:09 Pacific
Subject: Array of Strings |
Reply: (edit)You could also use a map from the standard template library (STL). ... struct ltstr { bool operator()(const char* s1, const char* s2) const { return strcmp(s1, s2) < 0; } }; ... map<const char*, int, ltstr> translator; translator["bank"] = "banco"; ... etc.
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: