View Single Post
Old 11-23-2004, 12:51 PM   #3 (permalink)
verdell32
Registered User
 
verdell32's Avatar
 
Join Date: Oct 2004
Posts: 35
verdell32 is on a distinguished road
Code for Setprice

This is the first part of the code and this works fine; it has already created the "hardwood file" that will hold the values for the Wood that a person would enter in. So what the program will do in the hardwood is : the cashier will enter in the Thickness, Width, Length and that will output the "Boardfoot" and the price will also be input and it will output the price that the person inputs. So I think that the price that is input will be multiplied by the measurements; and that should give you the totalprice; and the totalprice should print out on a ticket(Reciept). I hope I explained this well.
Thanks Valmont



Code:
// Program Documentation //////////////////////////////////////////////////////
//
// Project Name  : SETPRICE
//
// Source File   : setprice.cpp
//
// Programmed By : Shang Fields
//
// Last Revision : 11/8/2004
//
// Version Number: 0.1
//
// Program Description ////////////////////////////////////////////////////////
//
// This program will prompt the user for the name of a type of wood,
// and will output the current selling price for the wood.  
///////////////////////////////////////////////////////////////////////////////

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

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

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

int main( )
{
   char woodName[64];
   double price;

   //Get data from user
   cout << "Enter hardwood name: " ;
   cin.getline( woodName, sizeof( woodName ) );
   cout << "Enter price of wood: " ;
   cin >> price;
   //read data from file
   ofstream fout( "HARDWOOD.TXT" );

   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;
   getch();
   return 0;
}//endmn

Last edited by Valmont; 11-23-2004 at 05:42 PM.
verdell32 is offline   Reply With Quote