What Is Wrong With This C++ Program?

It compiles. It gets the user input but then goes right into the else on line 67.
The program should ask for the inventory number (PLU) then it asks for the amount of weight or amount of units. It should then calculate the total and store the amount and the weight in the arrays WeightAll and allTotal.
#include
#include
#include
using namespace std;
const int MAX = 100;
int num = 0;
int typePlu[MAX];
string productName[MAX];
int productType[MAX];
double price[MAX];
double inventory[MAX];
int pluInput;
double allWeights[100];
double totalAll[50];
void checkout (){
int pluInput;
double finPounds, finUnits, finTotal, weight,
disFinTotal, total, pounds, units;
while (pluInput != 0){
cout << "Enter a PLU code: " <> pluInput;
for(int i=0; i<num; i++)
if(pluInput == typePlu[i]){
cout << "Enter amount in pounds or units: " <> pounds;
total = pounds * price[i];
finTotal += total;
finPounds += pounds;
allWeights[0] += pounds;
}
else if (pluInput == 0){
if (finTotal >= 50){
cout << "Your total weight is "<< finPounds << endl;
cout << "Your total is $" << finTotal << endl;
disFinTotal = finTotal * .5;
cout << "Your discounted total is $"<< disFinTotal << endl;
totalAll[0] += finTotal;
totalAll[1] += disFinTotal;
}
else{
cout << "Your total weight is "<< finPounds << "lbs."<< endl;
cout << "You total is $" << finTotal << "." << endl;
totalAll[0] += finTotal;
}
}
else{
cout << "Incorrect input"<< endl;
pluInput = 1;
}
}
}
bool logout (){
bool quit = true;
cout << "Are you ready to quit?" <> quit;
if (quit == ‘N’){
checkout();
}
else{
cout << allWeights[0];
cout << totalAll[0];
cout << totalAll[1];
cout <> typePlu[num];
dataFile >> productName[num];
dataFile >> productType[num];
dataFile >> price[num];
dataFile >> inventory[num];
num++;
}
checkout();
return 0;
}

Both comments and pings are currently closed.

Comments are closed.

Powered by WordPress | Designed by: free css template | Thanks to hostgator coupon and web hosting reviews