Question: #define _CRT_SECURE_NO_WARNINGS #include #include #include char printMenu(); void printRules(); void editPlayerDetails(char*); int main() { char option = printMenu(); char playerName[25] = Player; while (option !=
#define _CRT_SECURE_NO_WARNINGS #include
char printMenu(); void printRules(); void editPlayerDetails(char*);
int main() { char option = printMenu(); char playerName[25] = "Player";
while (option != '4') { switch (option) { case '1': printRules(); break;
case '2': system("cls");
printf(" ---------------------------- "); printf("| PLAYER DETAILS | "); printf(" ---------------------------- ");
printf("Player name: %s ", playerName); editPlayerDetails(playerName); break;
case '3': play(playerName); break; };
option = printMenu(); }
return 0; }
char printMenu() { char option; printf(" ----------------------------------- "); printf("| NEVER OVER 50 GAME | "); printf(" ----------------------------------- "); printf("1. Game Rules "); printf("2. Edit Player Details "); printf("3. Play "); printf("4. Exit "); printf("Please pick an option: ");
scanf(" %c", &option);
while (option != '1' && option != '2' && option != '3' && option != '4') { printf(" Your chosen option is not listed, please try again: "); scanf(" %c", &option); }
return option;
}
void printRules() { char option;
printf(" ------------------------- "); printf("| GAME RULES | "); printf(" ------------------------- ");
printf("If the player's score is less than 50 after each turn, they can choose to continue. " "If they choose to continue, the number of turns will increase by 1. " "The player's turn will automatically stop if the final score exceeds 50 or has lost the game with 0 points. " "The player also loses the game and gets 0 points if their final score is less than 40 after deciding to end their turns. " "If the player's final score is in the range of 40 to 50, then the final point is equal to the final score subtracting the number of turns the user took to get the final score. ");
printf("Press 0 to go back to the main menu: "); scanf(" %c", &option);
while (option != '0') { printf(" Wrong option, press 0 to go back to the main menu: "); scanf(" %c", &option); }
}
void editPlayerDetails(char* playerName) { char option;
printf("Press 1 to edit or press 0 to go back to the main menu: "); scanf(" %c", &option);
while (option != '0' && option != '1') { printf(" Wrong option, press 1 to edit or press 0 to go back to the main menu: "); scanf(" %c", &option); }
if (option == '1') { printf(" Please enter new details: "); scanf(" %[^ ]%*c", playerName);
printf(" Player details changed "); printf("Player name: %s ", playerName);
editPlayerDetails(playerName); } }
void play(char* playerName) { char option; int turns = 0; int score = 0, randomNumber; int finalPoints; char continue_ = 'y';
printf(" ----------------------- "); printf("| PLAY | "); printf(" ----------------------- ");
while (continue_ == 'y' && score
printf("Turn %d, random number is %d and your score is %d ", turns, randomNumber, score); printf("Press 'y' to continue or 's' to stop: "); scanf(" %c", &continue_);
if (continue_ == 's') break; }
finalPoints = score - turns; if (score >= 40 && score
printf("Press 1 to play the game again or press 0 to go back to the main menu: "); scanf(" %c", &option);
while (option != '0' && option != '1') { printf(" Wrong option, press 1 to play the game again or press 0 to go back to the main menu: "); scanf(" %c", &option); }
if (option == '1') { play(playerName); } }
Output needed

Error I keep receiving:
![main() { char option = printMenu(); char playerName[25] = "Player"; while (option](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f39ecd9dbc2_93366f39ecd30db3.jpg)
NEVER OVER 50 GAME 1. Game Rules 2. Edit Player Details 3. Play 4. Exit Please pick an option: 5 Your chosen option is not listed, please try again: Console Application1.c Error List X Entire Solution 1 Error ! 1 Warning O O Messages *7 Build + IntelliSense Search Error List | * Code File Line Description 'play' undefined; assuming extern returning int 'play': redefinition; different basic types ! C4013 X C2371 Project Console Application1 Console Application 1 32 consoleapplication1.c consoleapplication1.c 114 C:\Users\akash source epos Assignment_3\x64\Debug Console Application 1.exe 1. Game Rules 2. Edit Player Details 3.Play 4. Exit Please pick an option: This game aims to add up a random number in the range of 1 to 20 each turn to get a final number in the range of 40to if the players score is less than 50 after each turn they can choose to continue. if they choose to continue, the number of turns will increase by 1. The player also looses the game and gets 0 points if the final score is less than after deciding to and their turns. if the players final score is in the range of 40 to50, then the final point is equal to the final score subtracting the number of turns the user took to get the final score.press 0 to go back to the main menu press 1 to edit or 0 to go back to main menu Turn 1, random number is 2, your score is 2 press y to continue or s to stop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
