Using the programming language of DEV C please help lumberin
Using the programming language of DEV C++, please help:
lumberin.txt is:
4. A lumber company needs to compute the values of certain engineering properties of its rectan- gular cross section lumber. The dimensions of the wood are given as base and height in inches integers. The required engineering properties are (as in Assignment 5, question 4) cross sectional area base × height base × height 12.0 moment of inertia = base height2 6.0 section modulus Write a program which reads the base and height from the input file, lumberin.txt, then calls three functions area), inertia), and modulus ) to compute the values of the required engineering properties. The main program then writes the three values to the output file lumberout.txt. This continues until the end of the input file is reached. Note that you must write your functions so that modulus () calls area() and inertia) calls modulus For example, if the file lumberin.txt consists of: 2 4 4 8 then the output file lumberout.txt would consist of: Lumber Size Cross sectional Moment of Inertia Section Modulus Area 8.00 32.00 36.00 5.33 42.67 36.00 10.67 4 x 8 170.67 108.00Solution
Program:
#include <iostream>
#include <fstream>
#include<string.h>
#include <stdlib.h>
#include <string>
#include <numeric>
using namespace std;
int main ()
{
int base,height;
FILE *fileIN = fopen ( \"lumberin.txt\", \"r\" );
ofstream outfile;
outfile.open (\"lumberout.txt\");
outfile<<\"Lumber Size Cross sectional Area Moment of Inertia Sectional Modulus\";
outfile<<\"\ ----------------------------------------------------------------------------------------\";
outfile<<\"\ \";
if ( fileIN != NULL )
{
char * pch;
char line [ 128 ]; /* or other suitable maximum line size */
while ( fgets ( line, sizeof line, fileIN ) != NULL ) /* read a line */
{
const char delim[] = \" \";
pch = strtok(line, delim);
base = atoi(pch);
outfile<<\" \";
outfile<<pch;
outfile<<\" X \";
pch = strtok (NULL, \" ,.-\");
height = atoi(pch);
outfile<<height;
outfile<<\"\\t\\t\\t\\t\";
outfile<< base * height;
outfile<<\"\\t\\t\\t\\t\\t\\t\\t\";
outfile<< ((double) (base * height * height * height) / (double) 12.0);
outfile<<\"\\t\\t\\t\\t\\t\\t\";
outfile<< ((double) (base * height * height) / (double) 6.0);
outfile<<\"\ \";
}
outfile.close();
fclose ( fileIN );
}
}
Sample output:

