Question: I need the code for this question to be answered in C++. This question requires you to generate the output using files, so please use
I need the code for this question to be answered in C++. This question requires you to generate the output using files, so please use an input or output file for the program to read and deal with. I have the picture of the question posted below.

So I receieved an answer for this already but it ONLY writes the first line, Toaster when I run the program. Also, I need the program to ASK the person running the code which file they would like to open, and then say it has written the words onto the text file opened. I am unsure why the code only writes the first like (toaster) but not the rest onto the text file, but I will submit the code as an example. I think we need to iterate through the vectors in a for loop to write it onto the file. Thank you for your time, here is the code, it needs ton generate ALL of the output text not just the first line.
#include
using namespace std;
int main() { string items[]={"Toaster", "Maize Dryer", "car vacuum"}; double price[]={29.92, 24.95, 19.99}; int quantity[]={3, 2, 1}; double total[]={89.85, 24.95, 39.98};
ofstream outfile; outfile.open("doc.txt"); outfile
return 0; }
R8.8 Give an output statement to write one line of a table containing a product description, quantity, unit price, and total price in dollars and cents. You want the columns to line up, like this: Iten Toaster Hair Dryer Car Vacuum Oty Price Total 3 $29.92$89.85 1%24.95 $24.95 2 $19.99 $39.98
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
