Help needed.

we have files suppose three or may be more and in each we have
CONVERTED_STATS = 7/different numbers in different files .now we have to generate an output file in which in we should have sum of the different numbers ie

if two files have CONVERTED_STATS = 7 and 9 respectively then in output file it should be shown like this CONVERTED_STATS = 16

please help me in coding if there are a number of input files.

Thanks in advance
What have you attempted?
Do you receive any errors?
Where is your main issue at, what are you having trouble doing?
i have to merge files into a single file. for example if in one file converted_stats = 7 and in other it is 9,there can be more than two file. then in final merged file converted stats should be sum of the input files.i,e if two files than converted_stats=16. how to use vectors of c++ to insert the value of one file and than add them in other file.

please help
thanks in advance

Well if you haven't tried anything already I'd suggest creating a function that searches for a heading and then give you a value... i.e. int stats = findValue("CONVERTED_STATS"); so if you run this for one file the function will return 7 and for the second file it'll return 9...

Then I'd create a string array which stores the names of every file to use and a separate string array to store the names of the values you want to search for.

Then just create a main function which gives ways for the user to enter which files and variables to use, and to loop through the combinations.

I'd create a for loop which iterates between the names of the values to search for and then have a nested for loop for each file. (you'll need an array to store the results), Before the outer loop moves to the next variable, calculate the total result.

That's a decent method I think, you can think of the code work yourself! :)
Hope that's helped
Topic archived. No new replies allowed.