
Lesson 4-3: Input and Output with Files
Program Input and the Software Design Process | 87
Name __________________________________________ Date _______________________
Section _________________________________________
Program Frame4 gets its input from a file.
// Program Frame4 reads input values that represent the
// dimensions of a print from a file and calculates and
// prints the amount of wood needed for a frame.
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
ifstream inFile;
inFile.open("Frame.in");
int side; // Vertical dimension in inches
int top; // Horizontal dimension in inches
int inchesOfWood; // Inches of wood needed ...