I have a C++ issue. Currently i have a text file that store the following data. I wish to do a simple program where it will read the data and print out the most frequent display of item and the quantity of it.
I do not wish to set an array of fixed number of words to search through the file as the item entered into the text file is not predetermined
Below are the structure of the data in the text file
The fourth value is the quantity and the second value is the item name
string itemid;
float totalprice;
string item[4] ={"Water","Bag","Fruit","File"};
int itemqty[4]={};
int founditem;
int foundyear;
string year;
string found;
cout<<endl;
for(int i = 0; i < MAX- 1; i++)
{
if(transactionpile[i].itemid !="")
{
for(int k=0; k<4;k++)
{
founditem = transactionpile[i].itemdesc.find(item[k]);
if(foundmonth<transactionpile[i].itemdesc.length())
{
//Add the totalprice of each found records to totalsalesmonth[k]
itemqty[k] += transactionpile[i].quantity;
are simple Windows API functions, check out on MSDN
I think that if you plan to interact with files in your games/programs you must know the set of API functions that handle files.
so on your free time.. investigate a bit.