So for a homework assignement i was suppose write a C++ program to determine which movie production is the most cost-effective domestically and globally based on the provided movie data. A gross profit is in US dollars. One way to measure the cost effective-ness is to take the ratio between the gross profit and production budget. The movie data are stored in a text file, where each field is separated by a whitespace. Each movie record has four fields: movie name, productionbudget, 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 title. The struct is provided below.
s t r u c t Movie {
s td : : s t r i n g name ;
double budget ;
double dome s t i c g r o s s ;
double g l o b a l g r o s s ;
} ;
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-effective movie production domestically.
2. Determination of the most cost-effective movie production globally.
Here is my code and im getting this str != NULL debug error. Someone please help.
#include <iostream>
#include <string>
using namespace std;
struct movie
{
string movieName;
double budget, domestic_gross, global_gross;
};
I straight c/p'ed your code and compiled fine (after including the missing libs ofc) - you dont evaluate *fp you try to set it NULL. The correct should be if(fp == NULL) - however I dont believe that is the source if your compiler error.
Also are you sure you compile the right project? I dont see any str variable if your code for the compiler to complain about.