// writing_to_file

#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;

int main()
{
	int length = 0;
	int width = 0;
	ifstream infile("C:/Temp/data1.txt");
	ofstream outfile("C:/Temp/results1.txt");

	infile >> length;
	infile >> width;

	outfile << length * 2 + width * 2 << endl;

	//****************************************
	
	infile.close();
	outfile.close();

	// ***************************************
	infile.open("C:/Temp/data2.txt");

	infile >> length;
	infile >> width;

	outfile.open("C:/Temp/results2.txt");

	outfile << length * 2 + width * 2 << endl;

	system("pause");
	return 0;
}// end of main
