I know this is pretty basic stuff, but Im having a problem with this program. It keeps dispearing off the screen with out finishing

It disapears after i enter the name of out_file_name

I have system("pause") at the end because im using a dev compiler and if that pause isnt put ther the program will run real fast and disapear off the screen. the system ("pause") prevents that.

thank you
#include < fstream>
#include <cstdlib>
int main()
using namespace std;
   char in_file_name[16], out_file_name [16];
   ifstream in_stream;
   ofstream out_stream;

cout << "I will sum six numbers taken from input\n"
     << "file and write the sum to an output file.\n";
cout << "Enter the input file name (maximum of 15 characters): \n";
cin >> in_file_name;
cout<< "Enter the output file name (maximum of 15 characters): ";
cin >> out_file_name;

// its right here that the program disapears off the screen

cout << "I will read numbers from the file"
     <<  in_file_name << "and\n"
     << "place the sum in the file\n"
     <<  out_file_name <<endl;
if (in_stream.fail())
     cout << "Input file opening failed.\n";
if (out_stream.fail())
      cout << "Output file opening failed.\n";
int first, second, third, fourth, fifth, sixth;
in_stream >> first >> second >> third >> fourth >> fifth >> sixth;
out_stream << "The sum of the first 3\n"
           <<"numbers in" << in_file_name << endl
           << "is" <<(first+second+third+fourth+fifth+sixth)
           << endl;

cout <<"end of program.\n";
return 0;

Last edited by shabbir; 24Aug2007 at 08:25.. Reason: Code block