Please help

I am having problems with some of the cases listed bellow code...any help you be great. for example I am having problems with number 4....but really I am having problems with all of them...

Some test cases that you may want to consider include the following:

1. What if one of the files contains no numbers?
2. What if both of the files contain no numbers?
3. What happens if one of the files has many more numbers than the other?
4. What happens if there are several blank lines after the last number in both files?
5. What happens if there are no blank lines, spaces, or characters of any sort after the last number in each file?



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main()
{
	ifstream fin1, fin2;
	ofstream fout;

	fin1.open("numbers1.txt");
	if(fin1.fail())
	{
		cout << "Input file opening failed." << endl;
		exit(1);
	}

	fin2.open("numbers2.txt");
	if(fin2.fail())
	{
		cout << "Input file opening failed." << endl;
		exit(1);
	}

	fout.open("output.txt");
	if(fout.fail())
	{
		cout << "Output file opening failed." << endl;
		exit(1);
	}

	int number1, number2;

	fin1 >> number1;
	fin2 >> number2;

	do
	{
		if(number1 == number2)
		{
			fout << number1 << endl;
			fout << number2 << endl;
			fin1 >> number1;
			fin2 >> number2;
		}
		if(number1 > number2)
		{
			fout << number2 << endl;
			fin2 >> number2;
		}
		if(number2 > number1)
		{
			fout << number1 << endl;
			fin1 >> number1;
		}
	}while(!fin1.eof() && !fin2.eof());
	
	while(!fin2.eof())
	{
		fout << number2 << endl;
		fin2 >> number2;
	}
	
	
	while(!fin1.eof())
	{
		fout << number1 << endl;
		fin1 >> number1;
	}
	
	if(fin1.eof())
	{
		if(number2 > number1)
		{
			fout << number1 << endl;
		}
		if(number1 > number2)
		{
			fout << number1 << endl;
		}
		if(number1 == number2)
		{
			fout << number1 << endl;
		}
	}
	
	if(fin2.eof())
	{
		if(number2 > number1)
		{
			fout << number2 << endl;
		}
		if(number1 > number2)
		{
			fout << number2 << endl;
		}
		if(number1 == number2)
		{
			
			fout << number2 << endl;
		}
	}
	
	
		
	fin1.close();
	fin2.close();
	fout.close();
	
	return 0;
}
i have no any idea...
All these would be fixed if you apply the method i suggested in your other post.
Topic archived. No new replies allowed.