Thursday, July 30, 2009

In C++, if i have 2 lines of integers separated by spaces from a source file, how do i read them into 2 arrays

for example:


0 2 6 7 8 2 5 4 7 5 8 0 9 2 6 4 8 3 5 6 7 8 3 4 5 8 1 2 3 0


0 0 0 0 0 8 9 3 2 4 6 9 1 2 4 6 5 9 8 7 5 6 9 1 9 8 7 4 6 5

In C++, if i have 2 lines of integers separated by spaces from a source file, how do i read them into 2 arrays
are they guaranteed to only be one digit? If so, you could use getc - get character. Otherwise, you could use gets - get string and use strtkn() - string token and break up the string based on spaces, or you could walk through the string yourself.

video cards

No comments:

Post a Comment