All pastes #9701 Raw Edit

Someone

public cpp v1 · immutable
#9701 ·published 2005-04-17 18:11 UTC
rendered paste body
void UPChandler (){	char barcode[6];	int x=1;	int item;	double sum = 0;	double nettax = 0;	while(!barcodelist.fail() && !barcodelist.eof());	{		cout <<"Transaction number " << x<< endl;		for(bool zero = false; !zero && !barcodelist.fail() && !barcodelist.eof();)		{			barcodelist.getline(barcode, 10, '\n');			if (barcode == "0")			{				zero=true;				barcodelist.get();			}			else item = UPCsearch(barcode); 					if (item < maxinventory)							{				sum +=inventory[item].price;				nettax +=taxcheck( item);								cout <<inventory[item].name << "    ";				cout << "$";				cout.setf(ios_base::fixed);				cout.setf(ios_base::showpoint);				cout.precision(2);				cout << inventory[item].price << endl;								cashregisterdata << inventory[item].name << "    ";				cashregisterdata << "$";				cashregisterdata.setf(ios_base::fixed);				cashregisterdata.setf(ios_base::showpoint);				cashregisterdata.precision(2);				cashregisterdata << inventory[item].price << endl;		   	   	   			}			}			cashregister (sum, tax);			cashregisterhardcopy (sum, tax);				++x;	}					return;}int UPCsearch (char upc[]){	int k = 0;	bool found = false;		while (!found && k<maxinventory)	{		if (!strcmp(upc,inventory[k].UPC)) found = true;		else ++k;	}		if (found)	{		cout << inventory[k].name << "     ";		cout.setf(ios_base::fixed);		cout.setf(ios_base::showpoint);		cout.precision(2);		cout << inventory[k].price << endl;	}		else	{		cout << "This item is not found, please get a price check.\n";		return (maxinventory + 1);	}				return (k);}