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

I really need my code edited if someone can help please: Here is the prompt belo

ID: 653994 • Letter: I

Question

I really need my code edited if someone can help please:

Here is the prompt below is my code:

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


const int RECORDS = 103; //total amount we have dont want them to change

struct Movie //Strut. fn given which defines the Movie struct
{
std::string name;
double budget;
double domestic_gross;
double global_gross;

};

int main()
{

   Movie mov[RECORDS];
double domestic[RECORDS];
double global[RECORDS];

     
   ifstream inFile("movie_data.txt"); //check if its okay
   if(!inFile.is_open())
{
       cerr << "Error. open File. " << endl;
       return -1;
   }

int iMovie = 0;
do{

   inFile >> mov[iMovie].name;
   inFile >> mov[iMovie].budget;
   inFile >> mov[iMovie].domestic_gross;
   inFile >> mov[iMovie].global_gross;

   iMovie++; //increment the Imovie

}while (inFile.good());
inFile.close(); //close the resourses


/*for(int i = 0; i < RECORDS; i++)
{

inFile >> mov[i].name >>mov[i].budget >>mov[i].domestic_gross >>mov[i].global_gross;

}*/ // another way of populating the thingy

for(int x = 0; x < RECORDS; x++)
   {
       domestic[x] = mov[x].domestic_gross / mov[x].budget;
       global[x] = mov[x].global_gross / mov[x].budget;
   }

  
   int max1 = domestic[0];


   domestic_movie = mov[0].name;


   for(int i = 0; i < RECORDS; i++)
   {
       if(domestic[i] > max1)
   {
   max1 = domestic[i];
   domestic_movie = mov[i].name;
   }
   }

   int max2 = global[0];
   global_movie = mov[0].name;
   for(int i = 0; i < RECORDS; i++)
   {
   if(global[i]>max2)
   {
   max2 = global[i];
   global_movie = mov[i].name;
   }


   cout << "Most cost-effective movie production domestically "<< max1;

cout << " for movie: " << domestic_movie<<endl;

cout << "Most cost-effective movie production globally " << max2;

cout << " for movie: " << global_movie << endl;


system("pause");
return 0;

}
  

Analysis of Movie Data
Please write a C++ program to determine which movie production is the most cost-e?ective domestically and globally based on the provided movie data. A gross pro?t is in US dollars. One way to measure the cost e?ectiveness is to take the ratio between the gross pro?t and production budget. For example, if the pro?t is 2000 USD and the production budget is 200 USD, then, the cost e?ectiveness is 2000.0/200.0 = 10.0. The movie data are stored in a text ?le, where each ?eld is separated by a whitespace. Each movie record has four ?elds: movie name, production budget, domestic gross and worldwide gross. There are 103 records in total. Please use an array of C++ structure to build the movie database from the ?le. The struct is provided below. struct Movie { std : : string name; double budget ; double domestic gross ; double global gross ; }; Please use the concept of modular programming to divide and conquer the tasks into functions and display proper outputs. For each function, it should have a meaningful name and clear objective. 1. Determination of the most cost-e?ective movie production domestically.
2. Determination of the most cost-efective movie production globally.

Explanation / Answer

// Movie.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

#include<iostream>

#include<string>

#include<fstream>

using namespace std;

?

const int RECORDS = 103; //total amount we have dont want them to change

int max;

string movie;

struct Movie //Strut. fn given which defines the Movie struct

{

std::string name;

double budget;

double domestic_gross;

double global_gross;

};

int getMaxcosteff(double movgr[RECORDS])

{

int max1 = movgr[0];

int retindex =0;

for(int i = 0; i < RECORDS; i++)

{

if(movgr[i] > max1)

{

max1 = movgr[i];

retindex=i;

}

}

return retindex;

}

int main()

{

Movie mov[RECORDS];

double domestic[RECORDS];

double global[RECORDS];

ifstream inFile("movie_data.txt"); //check if its okay

if(!inFile.is_open())

{

cerr << "Error. open File. " << endl;

return -1;

}

int iMovie = 0;

do{

inFile >> mov[iMovie].name;

inFile >> mov[iMovie].budget;

inFile >> mov[iMovie].domestic_gross;

inFile >> mov[iMovie].global_gross;

iMovie++; //increment the Imovie

}while (inFile.good());

inFile.close(); //close the resourses

?

/*for(int i = 0; i < RECORDS; i++)

{

inFile >> mov[i].name >>mov[i].budget >>mov[i].domestic_gross >>mov[i].global_gross;

}*/ // another way of populating the thingy

?

for(int x = 0; x < RECORDS; x++)

{

domestic[x] = mov[x].domestic_gross / mov[x].budget;

global[x] = mov[x].global_gross / mov[x].budget;

}

int max1 = domestic[getMaxcosteff(domestic)];

string domestic_movie = mov[getMaxcosteff(domestic)].name;

cout << "Most cost-effective movie production domestically "<< max1;

cout << " for movie: " << domestic_movie<<endl;

int max2 = global[getMaxcosteff(global)];

string global_movie = mov[getMaxcosteff(global)].name;

cout << "Most cost-effective movie production globally " << max2;

cout << " for movie: " << global_movie << endl;

?

system("pause");

return 0;

}

?