#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdlib.h>
#include <string>
//#include <cstdlib>

using namespace std;

//Define the structures to hold the records from the text files 
customer.txt, inventory.txt and sales.txt
//Customer_STRUCT
               struct Customer_STRUCT
               {
                 char cust_info[];

         int customer_id;
         char namef;
         char     namel;
         char     address;
         char     state;
         char     zip;
         char     active_y_n;
         char     dry_sweet;
         char     red_white;
         char     fruity_oakley;
         char     fullbody_lightbody;
         char     alco_nonalco;
               };
//Inventory_STRUCT
               struct Inventory_STRUCT
               {
//                char inventory_data[];
                 char wine_maker[14];
                 char wine_name[22];
                 char qty_on_hand[3];
                 char cost[6];
                 char price[6];
                 char dry_sweet[2];
                 char red_white[2];
                 char fruity_oakley[2];
                 char fullbody_lightbody[2];
//                char alco_nonalco[2];
         int wine_id;
               };
//Sales_STRUCT
               struct Sales_STRUCT
               {
                 char sales_data[];
                 char sales_id;
                 char wine_id;
                 char customer_id;
               };


//function prototypes to be used in the program - defined before main
()
int Get_Menu_Choice();                  //menu function
int Get_ManageCust_Submenu_Choice();    //manage customer submenu 
function
int Get_ManageInv_Submenu_Choice();     //manage inventory submenu 
function
int Get_Reports_Submenu_Choice();       //manage reports submenu 
function
int Read_Cust_Txt_file();
int Manage_customers();
int Manage_Inventory();
int Reports();
int     Exit_System();
//manage customers submenu
void Enter_New_Cust_Info();
int List_Customer();
int     Edit_Customer_Pref();
int Change_Customer_Status();
//manage inventory submenu
void    Enter_New_Inv_Info(fstream&);
int     List_Wine_Inv();
int     Alter_Inventory_Amount();

//reports submenu
int     List_Customers_Report();
int     List_Inventory();
int List_Run_Monthly_Sales();
void List_Sales(fstream&);


int     Inactive_Cust_Error();
int     Likert_Scale_Choices();
int     Display_Wine_List();
int     Active_Customers();
int     Update_Sales_();
int     Edit_Wine_Inv();
int     Close_Files();
int File_Open_Error();
int Write_Cust_Txt_File();
int Read_Cust_Txt_File();
int Read_Inv_Txt_File();
int Read_Sales_Txt_File();
int Write_Inv_Txt_File();
int Write_Sales_Txt_File();
int Save_To_Customer_file();
int Save_To_Inventory_file();
int Save_To_Customer_file();
int Output_To_Screen();
int Print();

int main ()
{
   //testing file output
   char buffer[130];
   char file_name[130];   //inventory.txt

   fstream edit_inventory_file;
   Inventory_STRUCT null_inv = { "","","","","","","","","",0};


        cout << "Enter the name of the file you want to display:";
        cin.getline(file_name, 130);
        ifstream in_file(file_name);
        if (!in_file)
        {
          cerr << endl;
          cerr << "ERROR: File could not be opened." << endl;
          cerr << "Program Terminated" << endl;
          exit(1);

          }

 //Open the file for both input and output

 in_file.open("inventory.txt", ios::in | ios::out );


   Enter_New_Inv_Info(edit_inventory_file);
    system ("PAUSE");
   return 0;


}  //end of main
  void Enter_New_Inv_Info(fstream& edit_inventory_file)
{

       Inventory_STRUCT inv_add;

       cout << "\nPlease enter WineID";
       cout << endl;
       cin  >> inv_add.wine_id;
       cout << endl;


       cout << "\nPlease enter the maker of the wine.";
       cout << endl;
       cin.getline(inv_add.wine_maker, 14);
       cout << endl;


       cout << "\nPlease enter the name of the wine.";
       cout << endl;
       cin.getline(inv_add.wine_name, 22);
       cout << endl;


       cout << "\nPlease enter the current quantity on hand";
       cout << endl;
       cin.getline(inv_add.qty_on_hand, 3);
       cout << endl;


       cout << "\nPlease the cost of the wine.";
       cout << endl;
       cin.getline(inv_add.cost, 6);
       cout << endl;


       cout << "\nPlease enter the price of the wine";
       cout << endl;
       cin.getline(inv_add.price, 6);
       cout << endl;


       cout << "\nPlease enter the dryness to sweetness factor";
       cout << endl;
       cin.getline(inv_add.dry_sweet, 2);
       cout << endl;


       cout << "\nPlease enter the redness to whiteness factor";
       cout << endl;
       cin.getline(inv_add.red_white, 2);
       cout << endl;


       cout << "\nPlease enter the fruity to oakey factor";
       cout << endl;
       cin.getline(inv_add.fruity_oakley, 2);
       cout << endl;


       cout << "\nPlease enter the full body to light body factor";
       cout << endl;
       cin.getline(inv_add.fullbody_lightbody, 2);
       cout << endl;


       cout << "\nPlease enter the alcoholic to nonalcoholic factor";
       cout << endl;
       //cin.getline(inv_add.alco_nonalco, 2);
       cout << endl;
}









To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/c-prog/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to