I am trying to create a program that ask for sales amount and displays total salary and writes the entry to a file. However my program has is only writing the last entry to the file. I have searched online for 2hours for a solution and cant find one.

I want all of the input to write to my file not just the last one

```
    #include <fstream>
    #include <iostream>
    #include <iomanip>

    using namespace std;

    void SavingFile(); //Declartion
    void Calculate();

    char FileName[20];
    double GrossPay;
    double TotalSalary;
    int employeeID=0;
    char response;
    int i=1;

    int main()

    {

    SavingFile();

    }

    void SavingFile()
    {

    cout << "\nEnter the name of the file you want to create: ";
    cin >> FileName;

      do

   {
       employeeID++;
     cout << endl << endl << "Enter sales amount for sales person ID " << employeeID <<" :                $";

      cin >> GrossPay;

      Calculate();

        cout <<"Sales amount for ID " << employeeID <<" : $" << TotalSalary <<endl;

        cout <<endl <<endl;

   do
    {

     ofstream Employee(FileName);
     Employee <<"Employee ID: "<< employeeID  <<" Sales Amount: $" << TotalSalary <<endl;
    cout << endl;
    i++;
    }
    while

        (employeeID == i);

      cout << "Do you want to process another employee ? (y/n): ";

      cin >> response;

    }

   while ( (response == 'Y') || (response == 'y') );

   }

    void Calculate()  // definition

    {

    TotalSalary = (GrossPay * .10) + 150;
    //return TotalSalary;
   }

```