Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I wrote a program using structs to get product records but now Ineed help on usi

ID: 3615446 • Letter: I

Question

I wrote a program using structs to get product records but now Ineed help on using that same program to add Input and Output Files.I'm completely lost on this one. Can someone help me out? I'llgreatly appreciate it. Here's what I have and what I need todo.

Use struct program and move into the CreateFile function.

Write the contents of the ReadFile Function.
a. Reopen the file in the correct mode
b. Read the records
c. Display a screen report.
d. Include a title and column headings

Use data below.

a. Stapler, 12458, 10, 5.50
b.Scissors, 64514, 11, 4.49
c. 5 Pencil Pkg, 78989, 18, 2.45
d. 3 Rolls Tape, 05050, 15, 1.99



#include<iostream.h>
#include<conio.h>
#include<fstream.h>

void main()
{
    struct productrecord
    {
        char name [10];
        int code;
        int quantity;
        double price;
       
        ofstreamoutfile("f:product.txt");
        if(!outfile)
       

    };
    char trash;

    productrecord product;

    cout<<"Please enter a product name: ";
    cin.get(product.name,9);
    cin.get(trash);

    cout<<endl<<"Please enter productcode: ";
    cin>>product.code;

    cout<<endl<<"Please enter number ofproducts: ";
    cin>>product.quantity;

    cout<<endl<<"Please enter Productprice ";
    cin>>product.price;

    cout<<endl<<product.name<<"";
    cout<<product.code<<" ";
    cout<<product.quantity<<" ";
    cout<<product.price<<endl;

}

Explanation / Answer

please rate-thanks #include #include #include #include using namespace std; struct productrecord     {         string name;         int code;         int quantity;         double price;       }; int CreateFile(productrecord product); void report(); void getinfo(productrecord ,ifstream& ,ofstream&); void decode(productrecord,string,ofstream&); string unpackit(string,int&); int main() {     productrecord product;     if(CreateFile(product)==1)         return 0;     report();   system("pause"); return 0; } void report() {ifstream in; char input[80]; in.open("output.txt");          //open file if(in.fail())            //is it ok?    { cout