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

Having trouble getting this program to work, please help? How would I get this p

ID: 3864026 • Letter: H

Question

Having trouble getting this program to work, please help? How would I get this program to run in c++ visual studios?

Program below:

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main()
{
   int max = 100;
   string names[];
   double salary[];
   double sales [];
   double bonus [];
   int count = 0;
   int maxsalesIndex = 0;
   string line;
   ifstream myfile("input.txt"); // oppning input file
   if (myfile.open())
   {
       int i = 0;
       double maxsales = 0;
       while (!myfile.eof()) // reading file unitl enf of file
       {
           string name;
           double slry;
           double sls;
           myfile >> name;
           myfile >> slry;
           myfile >> sls;
           cout << name << ' ';
           names[i] = name;
           salary[i] = slry;
           sales[i] = sls;
           if (sls >= 1000000)
               bonus[i] = 1000;
           else
               bonus[i] = 0;
           if (sls >= sales[maxsalesIndex])
               maxsalesIndex = i;
           count++;
           i++;
       }
       myfile.close();

       //printing output
       cout << "Name Salary Sales Bonus Total Pay" << endl;
       for (int i = 0;i<count;i++) {
           cout << names[i] << " " << salary[i] << " " << sales[i] << " " << bonus[i] << " " << (salary[i] + bonus[i]) << endl;
       }
       cout << "Sales Employee of the month : " << names[maxsalesIndex] << endl;
       cout << "Annual sold by " << names[maxsalesIndex] << " : $ " << sales[maxsalesIndex] << endl;
   }

   else cout << "Unable to open file";

   return 0;
}

Requirements are:

Program 3 Scoresheet Salesperson’s Pay Five parallel arrays are used, with room for at least 150 entries : Correct File I/O is done : Correct input function has while-not-eof loop to read input into arrays : And it determines how many sales employees there are: Bonus array data is calculated: Total Pay array contents is computed: Correct determination of Sales Employee of the Month: Output is done in a function: Five-column table: Name of Sales Employee of the Month: Sales total of Sales Employee of the Month:

Explanation / Answer

The Code seems to be fine. However please provide some predefined size . In Visual C++ create a simple console application. Open the studio. Goto File. Goto new. Create a new project. Under Visual C++ category, create Win32 Console application. Follow necessary steps and finish it. Then try to compile. Apply necessary break points. See where the code is throwing error. Make sure the necessary file are there defined path as mentioned in program.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote