Can someone help me or give me a hint of how to do this problem?
I am supposed to have two files of sorted numbers, for example:
"Section52.cpp" (name of file)
1
4
6
8
12
15
17
"Section53.cpp" (name of second file)
2
5
7
10
11
16
19
21
24
25
So I am supposed to create a third file that has all of these numbers SORTED from both files in it.
I am not supposed to use vectors or arrays. So I don't really know a lot about ifstream and ofstream except that I am supposed to use both of these to solve this problem.
This is what I have so far:
and now I am stumped!!!!Code:#include <iostream> #include <fstream> using namespace std; int main() { ifstream FUN1, FUN2; FUN1.open("Section52.cpp"); FUN2.open("Section53.cpp"); ofstream RUN; RUN.open("Section54.cpp"); int aNumber, anotherNumber; int count = 0; int count2 = 0; while (FUN1 >> aNumber) { count++; RUN << aNumber; } while (FUN2 >> anotherNumber) { count2++; RUN << anotherNumber; } int theNumber; if (count >= count2) { theNumber = count; } else { theNumber = count2; }