Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please modify the following c code to display the studio and the number of theaters the movie is playing in as shown in the example

Please modify the following c code to display the studio and the number of theaters the movie is playing in as shown in the example below

image text in transcribed

#include #include #include

#define MAX_MOVIES 20

struct movie_type { char name[128]; char gross[128]; };

char *ptr, buffer[16392], cmd[512]; char company_name[128], zipcode[64]; char wind_speed[64], wind_direction[64]; char us_state[32], us_city[128], tod[64]; int i, n, first_time, indx, state; struct movie_type movies[MAX_MOVIES];

int main(int argc, char *argv[]) { FILE *fp;

sprintf(cmd, "wget -qO- http://www.boxofficemojo.com/weekend/chart/");

if((fp = popen(cmd, "r")) != NULL) { state = 0;

while (!feof(fp)) { if (fgets(buffer, sizeof(buffer) - 1, fp) != NULL) { switch (state) { case 0: if (strstr(buffer, "

case 1: if (strstr(buffer, "movies") != NULL) { if ((ptr = strstr(buffer, "")) != NULL) { ptr += 3;

indx = 0; while (*ptr != '

indx++; ptr++; }

state = 2; } } break;

case 2: if ((ptr = strstr(buffer, "right")) != NULL) { if ((ptr = strstr(buffer, "")) != NULL) { ptr += 3;

indx = 0; while (*ptr != '

indx++; ptr++; }

if (++i >= MAX_MOVIES) state = 3; else state = 1; } } break;

case 3:

break; } } }

pclose(fp);

// dislay results

for (i=0,first_time=1;i

printf(" %2d) %-28.28s %s ", i+1, movies[i].name, movies[i].gross); } } }

return 0; }

2,941 2,388 3,246 3,535 2,421 2,054 2,577 2,505 2,046 2,560 373 1,558 1,044 1,489 2,029 1,474 1,238 1,815 1,682 821 145 1) Jigsaw 2) Tyler Perry's Boo 21 A Madea Hal $10,052,608 3) Geostorm 4) Happy Death Day 5) Blade Runner 2049 6) Thank You for Your Service (2017 $3,817,700 7) Only The Brave 8) The Foreigner 9) Suburbicon $16,640,452 LGF LGF WB $5,903, 428 $5,078,685 $4,117,395 WB Sony STX $3,502,095 $3,443,433 $2,840,246 $2,503,338 $1,729,535 $1,702,605 $1,641,515 $1,625,354 $1,309,104 $1,275,301 $1,252,142 $1,212,950 $1,027,701 11) Let there be Light 12) American Made 13) Victoria and Abdul 14) Kingsman: The Golden Circle 15) The Mountain Between Us 16) The LEGO Ninjago Movie 17) Same Kind of Different as Me 18) The Snowman 19) My Little Pony: The Movie 20) Marshall 21) The Florida Project 22) Loving Vincent 23 Goodbye Christopher Robin 24) Battle of the Sexes 25) The Killing of a Sacred Deer 26) Despicable Me 3 27) Jane (2017) 28) All I See is You 29) Wonderstruck 30) Flatliners (2017) ADC Focus Fox Fox WB PFR LGF ORF A24 Good Deed FoxS FoxS $905,053 $522,498 $472,047 $337,302 $321,777 $225,171 $170,960 $146,662 $144,076 $132,065 $129,605 291 283 ORF RAtt on 263

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2018 Dublin Ireland September 10 14 2018 Proceedings Part 1 Lnai 11051

Authors: Michele Berlingerio ,Francesco Bonchi ,Thomas Gartner ,Neil Hurley ,Georgiana Ifrim

1st Edition

3030109240, 978-3030109240

More Books

Students also viewed these Databases questions

Question

code using position byusing html and cssin the given below picture

Answered: 1 week ago