I have to make a program that grabs two values from a txt file and multiplies them together but it's getting totally random values. The output of the following code is: This is the total bill 922337189306963456.00Press any key to continue...
// This program will read in the qunatity of a particular item and its price.
// It will then print out the total price.
// The input will come from a data file and the output will go to
// an output file.
// Cody Steffens
ifstream dataIn; // defines an input stream for a data file
ofstream dataOut; // defines an output stream for an output file
int quantity; // contains the amount of items purchased
float itemPrice; // contains the price of each item
float totalBill; // contains the total bill. The price of all items
dataIn.open("transaction.txt"); // This opens the file.
// Fill in the appropriate code in the blank below
cout << setprecision(2) << fixed << showpoint; // formatted output
// Fill in the input statement that brings in the
// quantity and price of the item.
dataIn >> quantity;
dataIn >> itemPrice;
// Fill in the assignment statement that determines the totalbill.
totalBill = float(quantity) * itemPrice;
// Fill in the output statement that prints the total bill, with a label,
// to an output.
cout << "This is the total bill " << totalBill;