c++ Read text file and input the numbers into a 2D array
I'm really struggling at the beginning stages of this task. I need to have
the user input the name of a text file on the command line. The file will
be a list of space separated integers. I want to go through the numbers
and input them into a 2D array or vector. This will always be a square
dimensional array, so if there are 100 numbers I can do a 10X10. I'm
pretty comfortable with (1dimensional)arrays (for a beginner of almost 2
months), but am really confused with getting the input from a text file
aspect of this. The main parts I am unfamiliar with are reading from a
text file and dynamic arrays (since I won't know the size until run-time.
WOuld I use getline here?
No comments:
Post a Comment