This is a sample output I did without files, just with cin/cout
Now I am trying to turn the original code into one with files instead of cin/cout
****************************************
What is the name of your farm? fleet farm
What is the type of your food item? carrot
How many carrots do you want? 3
What does each cost? (please start with a $): $.5
3 carrots @ $0.5 each costs $1.5
How much cash did you give me? (dont forget the $): $5
You bought 3 carrots at @ $0.5 each
Amount Paid: ************ $5
Cost: ******************* $1.5
Cash Returned: ********** $3.5
Thank you for shopping at fleet farm
****************************************
This is the code that I am trying to use to output into the file
1 2 3 4 5 6 7 8 9 10 11 12 13
|
out_file << "You bought " << amount << " " << food_item << "s at @ $" << cost << " each\n\n";
out_file << left << setw(25) << setfill('*')
<< "Amount Paid: ";
out_file << right << " $" << amount_paid << "\n";
out_file << left << setw(25) << setfill('*')
<< "Cost: ";
out_file << right << " $" << total << "\n";
out_file << left << setw(25) << setfill('*')
<< "Cash Returned: ";
out_file << right << " $" << return_amount << "\n\n";
out_file << "Thank you for shopping at " << farm_name;
|