Question: The following program is supposed to read the length and width of a rectangle from the user then calculates the area of the rectangle. The

The following program is supposed to read the length and width of a rectangle from the user then calculates the area of the rectangle. The program should write the area to an output file named output.txt. However, it fails to do so. Rewrite the program so that it accomplishes wha is intended to do. Make sure to include a statement to close the file. Also, write comments throughout the program to illustrate how you fixed the program. \#include using namespace std; int main() double length, width; ifstream outfile; outfile
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
