Oct 19, 2015 at 12:48am UTC
Hey, I'm trying to make a simple inventory program, but whenever I run it, it starts to say no operator matches these operands. I'll upload a picture of the errors in a minute.
Here are the errors: http://i.imgur.com/00bTcqu.png
Can anyone tell me how to fix it?
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
/*This program calculates inventory data*/
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <sstream>
using namespace std;
int main()
{
string tool;
double unitCost;
double numberOfUnits;
double totalCost = 0;
char ch = ' ' ;
bool done = false ;
ifstream input;
int counter;
ifstream inFile;
ofstream outFile;
inFile.open("janeInventory1.txt" );
if (!inFile)
{
cout << "Cannot open input file. Program Terminates! " << endl;
return 1;
}
outFile.open("janeInventory1.out" );
for (int i = 0; i<6; i++)
{
cin >> tool >> numberOfUnits >> unitCost;
cout << tool << " " << numberOfUnits << " " << unitCost << endl;
}
return 0;
outFile << fixed << showpoint << setprecision(2);
inFile >> tool >> numberOfUnits >> unitCost;
while (inFile)
{
totalCost = numberOfUnits * unitCost;
}
cout << "**************************************************************************" << endl;
cout << "Inventory for Jane Doe National Hardware " << endl;
cout << "**************************************************************************" << endl;
cout << endl;
cout << "ITEM NUMBER OF UNITS UNIT COST ($) TOTAL VALUE " << endl;
cout << "***************************************************************************" << endl;
ch = ' ' ;
while ((ch = input.peek() != EOF))
string tool = "" ;
double units = 0.0;
double cost = 0.0;
input >> tool >> units >> cost;
cout << left << setw(9) << tool;
cout << left << setfill << (' ' ) << setw(15) << units;
cout << left << setfill << (' ' ) << setw(25) << cost;
cout << left << setfill << (' ' ) << setw(20) << numberOfUnits * unitCost;
totalCost = 0.0;
}
; }
Last edited on Oct 19, 2015 at 12:50am UTC