+ 2
How to have different answers on different out put
I'm wondering if anyone has any idea on how to take input from one file (.txt) and output it into multiple output files (.txt). For example if it read 3 integer values, it would output the first value to the first output file and so on. I'm curious just to see if I can save myself some time by not having to run an output function three different times.
1 Réponse
0
I'm not sure how to output them to a separate file, but outputting those normally could work using a for loop (or possibly a while loop. I always mix those up); something like, while 'a' is less than 3 (for those first three ints) run a++ and cout each integer that 'a' comes across. This will stop the loop at the third integer, assuming that the text file is in a basic list-like format.
I'm by no means an expert on this, but it's a thought. let me know how you solve this. Best of luck, Lesley! Hope this helps!