using DevC++, working on input stream, having input file linking issue

I am writing code for input and output streams, i have 2 files in the same working directory of where my code file resides, but i am having issue that my stream data is not linking to files, anyone can resolve this issue, or have any remedy....

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
  #include <iostream>
#include <fstream>
#include <cstdlib>

using namespace std;

int main()
{
	ifstream in_stream;
	ofstream out_stream;
	int sum, first, second, third;
	
	in_stream.open("infile.dat");
	if (in_stream.fail());
	{
		cout << "Input file opening failed. \n";
		exit (1);
	}
	out_stream.open("outfile.dat");
	if (out_stream.fail());
	{
		cout << "Output file opening failed. \n";
		exit (1);
	}
	in_stream >> first >> second >> third;
	out_stream << "The value of first, two and three " << (first + second + third) << endl;
	
	in_stream.close();
	out_stream.close();
	return 0;
}
Topic archived. No new replies allowed.