1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
#include <fstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
using namespace std;
const int invSize = 2;
void getInventory (ifstream& infile, vector<string> itemID, vector<string> itemName, vector<int> pOrdered,
vector<int> pInStore, vector<int> pSold, vector<double> manufPrice, vector<double> sellingPrice);
int main()
{
/* vector<int> itemQuantity; */
vector<string> itemID;
vector<string> itemName;
vector<int> pOrdered;
vector<int> pInStore;
vector<int> pSold;
vector<double> manufPrice;
vector<double> sellingPrice;
ifstream infile;
infile.open("I:\\inventory.txt");
if (!infile)
{
cout << "Input file (inventory.txt) does not exsit." << endl;
system ("pause");
return 1;
}
getInventory(infile, itemID, itemName, pOrdered, pInStore, pSold, manufPrice, sellingPrice);
infile.close();
return 0;
}
void getInventory(ifstream& infile, vector<string> itemID, vector<string> itemName, vector<int> pOrdered,
vector<int> pInStore, vector<int> pSold, vector<double> manufPrice,
vector<double> sellingPrice)
{
unsigned int i;
string line;
for (i = 0; i < itemID.size(); i++)
{
infile >> itemID[i]
>> itemName[i]
>> pOrdered[i]
>> pInStore[i]
>> pSold[i]
>> manufPrice[i]
>> sellingPrice[i] ;
}
cout << endl;
cout << "Item ID: " <<itemID<< ;
return;
}
|