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

I have this program this current program that i\'m trying to modifyso the report

ID: 3615662 • Letter: I

Question

I have this program this current program that i'm trying to modifyso the report will come out aligned right. I know the commands

cout.width() cout.setf(ios:fixed) and cout.precision()
I'm just not sure where to put them in my program to aligneverything correctly. Can someone help me out? Thanks in advance.Here is my program.

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

void main()
{
    void createFile();
    void readFile();

    createFile();
    readFile();
}

void createFile()
{
    struct productrecord
    {
        char name[15];
        int code;
        int quantity;
        double price;
    };

    char trash;
   
    productrecord product;

    ofstream outfile("product.txt");
    if(!outfile)
        cout<<"File can not beopened"<<endl;
    else
    {
        cout<<"Type 'exit' toexit program or"<<endl;
        cout<<"Enter theproduct name: ";
        cin.get(product.name,15);
        cin.get(trash);

        while (strcmp (product.name,"exit")!=0)
        {
           cout<<endl<<"Please enter product code: ";
           cin>>product.code;

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

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

           outfile<<product.name<<","<<product.code<<","<<product.quantity<<""<<product.price<<endl;
           getch();
           system("CLS");

           cin.get(trash);
           cout<<"Please enter product name or type 'exit' to exit:";
           cin.get(product.name, 15);
        }
    }
}

void readFile()
{
    struct productrecord
    {
        char name[15];
        int code;
        int quantity;
        double price;
    };
    char trash;

    productrecord product;

    ifstream inFile("product.txt");
    cout<<"           ProductRecord               "<<endl;
    cout<<"Name       Code          Quantity            Price"<<endl;
    inFile.get(product.name, 15, ',');

    while(inFile)
    {
        inFile.get(trash);
       inFile>>product.code;
        inFile.get(trash);
       inFile>>product.quantity;
        inFile.get(trash);
       inFile>>product.price;
        inFile.get(trash);
       cout<<product.name<<"         "<<product.code<<"        "<<product.quantity<<
           "                "<<product.price<<endl;

        inFile.get(product.name, 15,',');
    }
}

Explanation / Answer

please rate - thanks #include #include #include #include #include #include void main() {     void createFile();     void readFile();     createFile();     readFile(); } void createFile() {     struct productrecord     {         char name[15];         int code;         int quantity;         double price;     };     char trash;     productrecord product;     ofstream outfile("product.txt");     if(!outfile)         cout