Question
C++ Need help sorting an array: these two functions pull data and put it into an array. I need to run loadmovies and sort the
C++ Need help sorting an array: these two functions pull data and put it into an array.
I need to run loadmovies and sort the array based on movies[i].expectedYield (ie 0,1 or 2), and then add the data from LoadRooms
void LoadMovies(Movie movies[]){ //loads movie data from file
int numMovies;
ifstream infile; infile.open("movies.txt"); infile>>numMovies;
for(int i=0; i
infile.close(); }
void LoadRooms(Movie movies[], int size){ //loads room data from file. ifstream infile; infile.open("rooms.txt");
for(int i=0; i
movies.txt
9 Gemini_Man 117.9 2 Joker 122.8 2 Zombieland 99.5 2 Knives_Out 130.1 1 Judy 118.3 0 Downton_Abbey 123.8 0 It 170.0 2 Black_and_Blue 108.4 1 Terminator_Dark_Fate 134.9 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started