reading a text file into an array

前端 未结 2 709
你的背包
你的背包 2021-01-18 23:24

I\'m really new to programming, and after thinking hard about this for a week for a summer project, I\'d really appreciate some help!

I\'m trying to read in a long t

2条回答
  •  逝去的感伤
    2021-01-19 00:16

    I'm not going to do your summer project, but here's some remarks:

    1) The text file is not a text file but an RTF file, which is text with formatting. You probably made/saved it using TextEdit. If so, use the 'Make Plain Text' menu item to fix this.

    2) Your program seems to be doing the following: read 26x26 (why 26?) characters from a file (including spaces, newlines etcetera), put them in a 26x26 array, and then print them one by one. I'm not clear what you're trying to achieve, but it appears to have something to do with formatting the array, in which case you will probably want to think about how to handle whitespace characters in the input, and printing them yourself when generating output.

提交回复
热议问题