I have an assignment where we need to place two words (separated by a space) into a 2-d array. Since the words are not separated by anything, I thought taking in two separate c-style strings and then concatenating then into a separate 2-d array would work? But I keep getting several errors or crashes when I try to do this. Any input would help.
An example of the file would be "ten heart jack heart queen heart king heart" Where you need to have "ten heart" as a single value in the 2-d array, and they are not separated by commas.
Please edit your post and make sure your code is [code]between code tags[/code] so that it has line numbers and syntax highlighting, as well as proper indentation.
SamualTP wrote:
Since the words are not separated by anything, I thought taking in two separate c-style strings and then concatenating then into a separate 2-d array would work?
Why not std::string and no arrays at all? In general you should avoid using c-style strings as they are a pain to work with and in fact are very dangerous.