This is a class assignment where my goal is to read in words from a text file in
ID: 3527730 • Letter: T
Question
This is a class assignment where my goal is to read in words from a text file into a 2D-Array. What I want to do is read in word by word to the array. For example, say I have "Harry met Sally and went to dinner". Using my code below, I get "H a r r y m e t . . ." We are not allowed to use the string library or string data types. So now I am confused as every tutorial I have found so far says I need a string variable as a parameter for getline. Thanks for any help! I just need to be pointed in the right direction. char twodArray[size][colSize]; ifstream file; file.open("thetext.txt"); for(row = 0; row < colSize; col++) { fin >> twodArray[row][col]; cout << twodArray[row][col]; } }Explanation / Answer
http://stackoverflow.com/questions/7459503/updating-2d-array-through-scanner
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.