I would like to create a function that reads each line of the input and produces its sum and save that as sum.txt using C++
问题 Let's assume that I have the following input: 1 2 3 5 6 10 11 13 stored in wow.txt . I would like to create a function that reads each line of the input and produces its sum and save that as sum.txt using C++. In the input file, we have the following: 1) we don't know the length of each line, but it has at most 10 integers. 2) each integer is separated by a space. So I started with ifstream inFile; inFile.open("wow.txt"); ofstream outFile; outFile.open("sum.txt"); and wasn't sure what to do