//********************************************************************** // Rectangle program 3 // This program calculates the area of a rectangle with user input // for the dimensions and output to a file //********************************************************************** #include #include using namespace std; int main() { ofstream fout("area.txt"); //OPENS THE TEXT FILE FOR OUTPUT int base; //the base of the rectangle int height; //the height of the rectangle int area; //the area of the rectangle //read values to base and height cout << "Enter a value for base: "; cin >> base; cout << "Enter a value for height: "; cin >> height; //calculate the area area = base*height; //output the result fout << "The area is " << area << endl; //SENDS RESULTS TO THE TEXT FILE fout.close(); //CLOSES THE FILE return 0; }