Sales Program HELLLP PLEASE..!!! How do I even get started..? I'm very new to C++

Input Data File Layout (SALES-RECORD)
-----------------------------------------------------
Field Data
Name Type
-----------------------------------------------------
recordCode int (should always be 61)
salseRep int (sorted by this field)
dateOfSale string (mmddyy)
productCode string (5 characters)
productDescription string (15 characters)
quantitySold int (>= 0)
unitPrice double (> 0 and <100)
-----------------------------------------------------
Input Data File Format (Filename: sales_01.txt)
61 10003 050714 TB001 Toothbrush 001 01.00
61 10003 051314 SB005 Bar_Soap 005 00.50
61 10005 050114 MP070 Kitchen_Mop 002 10.00
61 10006 050114 TB001 Tooth_Brush 004 01.00
61 10006 050714 TP002 Tooth_Paste 023 01.12
61 10006 050714 TP002 Mouthwash 013 00.98
61 10006 051614 SB005 Bar_Soap 001 00.50
61 10009 051914 SP008 Soap_Powder 238 01.89
61 10009 052514 WF080 Floor_Wax 005 02.98
-----------------------------------------------------
1. Code a program to read and properly display the file.
Project Name: Ex07_Sales
Source Name: Ex07_Sales.cpp


2. Sample Program Run
*** start of program ***
Enter filename("sales_01.txt"): sales_01.txt

61 10003 05-07-14 TB001 Toothbrush 1 1.00
61 10003 05-13-14 SB005 Bar_Soap 5 0.50
61 10005 05-01-14 MP070 Kitchen_Mop 2 10.00
61 10006 05-01-14 TB001 Tooth_Brush 4 1.00
61 10006 05-07-14 TP002 Tooth_Paste 23 1.12
61 10006 05-07-14 TP002 Mouthwash 13 0.98
61 10006 05-16-14 SB005 Bar_Soap 1 0.50
61 10009 05-19-14 SP008 Soap_Powder 238 1.89
61 10009 05-25-14 WF080 Floor_Wax 5 2.98

Run program again(y/n)?
What seems to be the problem? can we see the code?
the problem is creating the code...lol
heres what i got soo far but feels so wrong.../: since i'm going off from the directions, and this is due tomorrow..!! Someone save ME..!!


#include <iostream>
#include <iomanip>
using namespace std;

struct menuItemType
{
string name;
double price;
};

void GetData(menuItemType & menu, string name, double price)
{
menu.name = name;
menu.price = price;
}

void ShowMenu()
{
cout << "61 10003 050714 TB001 Toothbrush 001 01.00\n"
<< "61 10003 051314 SB005 Bar_Soap 005 00.50\n"
<< "61 10005 050114 MP070 Kitchen_Mop 002 10.00\n"
<< "61 10006 050114 TB001 Tooth_Brush 004 01.00\n"
<< "61 10006 050714 TP002 Tooth_Paste 023 01.12\n"
<< "61 10006 050714 TP002 Mouthwash 013 00.98\n"
<< "61 10006 051614 SB005 Bar_Soap 001 00.50\n"
<< "61 10009 051914 SP008 Soap_Powder 238 01.89\n"
<< "61 10009 052514 WF080 Floor_Wax 005 02.98\n";
}
Hi,

What you need to do is use file input/output to read data from a file called "sales_01.txt"

Every time you load a record from the file, save it into an instance of your structure (your structure should contain more members).

Then after you've reached the end of file, print out the data you have loaded.

Joe - C++ tutor
Topic archived. No new replies allowed.