Monday, July 27, 2009

How do I pair up data from two different files using c++???

I have a file with 1800 lines of numbers and I want to pair them up with 1800 lines of text. How would I go about pairing the two files up in order using C++?

How do I pair up data from two different files using c++???
Well, in C++ I'd create a class that carries a number and a string as private data. Then I'd create a method (public of course) that sets that data. Then the rest is simple. You create a linked list or array of these objects in the heap memory, add code to sequentially load the number and the string from your two separate files and then they are all nice neat little instantiations of your class in memory and accessible really quickly until you destroy them. I hope this gets you started.

apple

No comments:

Post a Comment