82.8k views
4 votes
write a program that implements a simple movie selection decision tree. The decision tree will help the user determine which Dwayne Johnson movie to see.

1 Answer

0 votes

Answer:

In order to make the following code in C it is necessary to take in consideration the possible tree of choices, or decision make trees.

Code:

#include <stdio.h>

int main(){

printf("Please answer with (y/n) \\");

printf("How about comedy movies? ");

char optional[2];

scanf("%s",&optional);

if(optional[0] == 'y'){

printf("Recommended: CENTRAL INTELLIGENCE\\");

} else if(optional[0] == 'n'){

printf("Then, how about a current movie ? ");

scanf("%s",&optional);

if(optional[0] == 'y' ){

printf("Recommended: HOBBS & SHAW\\");

}else if(optional[0] == 'n') {

printf("how about electronic games ? ");

scanf("%s",&optional);

if(optional[0] == 'y' ){

printf("Certified Fresh ? ");

scanf("%s",&optional);

if(optional[0] == 'y'){

printf("recommended JUMANJI : WELCOME TO THE JUNGLE\\");

}else if(optional[0] == 'n') {

printf("RAMPAGE");

}

}else if(optional[0] == 'n') {

printf("about franchises ? ");

scanf("%s",&optional);

if(optional[0] == 'y'){

printf("Recommended: FAST FIVE\\");

}else if(optional[0] == 'n') {

printf("How about animation ? ");

scanf("%s",&optional);

if(optional[0] == 'y'){

printf("recommended: MOANA\\");

}else if(optional[0] == 'n') {

printf("recommended: SKYSCRAPPER\\");

}

}

}

}

}

return 1;

}

User Blejzz
by
6.6k points