View Single Post
Old 11-22-2004, 12:59 PM   #1 (permalink)
verdell32
Registered User
 
verdell32's Avatar
 
Join Date: Oct 2004
Posts: 35
verdell32 is on a distinguished road
hardwood Program help

I have already done the first part of the program called setprice; now I am working on the hardwood.cpp and in order to do this I had to know what a "boardfoot" is and this is how I am suppossed to come up with the calculations.
But I am stuck on this point. Could some one look over my code and see if I am doing it correctly?

Code:
// Include Files //////////////////////////////////////////////////////////////
#include <iostream.h>
#include <iomanip.h>
#include <conio.h>
#include <fstream.h>

// Function Prototypes ////////////////////////////////////////////////////////

// Program Mainline ///////////////////////////////////////////////////////////

int main( )
{
   char woodName[64];
   double price;
   int boardfoot;
   int thickness;
   int width;
   int length;

   //Get data from user
   cout << "Enter hardwood name: " ;
   cin.getline( woodName, sizeof( woodName ) );
   cout << "Enter price of wood: " ;
   cin >> price;
   cout<< "Enter thickness:";
   cin >> thickness;
   cout << "Enter width:";
   cin >> width
   cout <<"Enter length:";
   cin >> length;

   //read data from file
   ofstream fout( "HARDWOOD.TXT" );

   //Calculations
   boardfoot = (thickness * width * length) /12;
   getPrice = don't know how to calculate once the person inputs the price for the oak 2.43,red oak 3.45,walnut 4.43,birch 1.99?
   

   if (fout.fail() ) {
      cout << "Could not open file." <<endl;
      getch();
      return 1;
   }//endif

   fout << woodName <<",\t"<< price << endl;
   cout << woodName <<",\t"<< price << endl;
   cout << "Above data written to file HARDWOOD.TXT" << endl;
   cout << woodName <<"\t"<<boardfoot<<enl;
   cout << getPrice << "\t"<< getPrice<<endl;
   getch();
   return 0;
   }//endmn

Last edited by Valmont; 11-22-2004 at 01:45 PM.
verdell32 is offline   Reply With Quote