October 22, 2024
Chicago 12, Melborne City, USA
C#

Need to have a working menu but it won't run


I have a previous code similar to this project that has run before. However, now I can’t get this to run.

Yahtzee.c

#include "Yahtzee.h"

int main(void)
{   
    int input = 0;

    do
    {
        input = option_choice(options());
    } while (input != 3);
    
    return 0; 

}

Function.c

#include "Yahtzee.h"

int options(void)
{
    int options = 0;

    do
    {
        printf("Main Menu:\n\n"
        
        "1. Display Rules\n"
        
        "2. Playing Games\n"
        
        "3. Exit\n"
        
        "Input your choose to continue: ");
        
        scanf("%d", &options);
    } while (options < 1 || options > 3);
    
    return options;

}

int option_choice(void)
{
int input = 0;

    switch (input)
    {
        case 1:
        {
            printf("\nThe scorecard used for Yahtzee is composed of two sections.\n");
            printf("A upper section and a lower section.\n");
            printf("A total of thirteen boxes or thirteen scoring combinations are divided amongst the sections.\n");
            printf("The upper section consists of boxes that are scored by summing the value of the dice matching the faces of the box.\n");
            printf("If a player rolls four 3's, then the score placed in the 3's box is the sum of the dice which is 12.\n");
            printf("Once a player has chosen to score a box, it may not be changed and the combination is no longer in play for future rounds.\n");
            printf("If the sum of the scores in the upper section is greater than or equal to 63, then 35 more points are added to the players overall score as a bonus.\n");
            printf("The lower section contains a number of poker like combinations.\n");
            printf("Three of a kind: Three dice with the same face. Sum of all face values on the 5 dice.\n");
            printf("Four of a kind: Four dice with the same face. Sum of all face values on the 5 dice.\n");
            printf("Full house: One pair and a three of a kind. 25 points.\n");
            printf("Small straight: A sequence of four dice. 30 points.\n");
            printf("Large straight: A sequence of five dice. 40 points.\n");
            printf("Yahtzee!!!(five of a kind): Five dice with the same face. 50 points.\n");
            printf("Chance: May be used for any sequence of dice; this is the catch all combination. Sum of all face values on the 5 dice.\n\n");
            break;
        }
    
        case 2: //Play the game and the mechanics of the game.
        {
            break;
        }
    
        case 3:
        {       
            printf("Exit Game\n\n");
            break;
        }
    }
    return input;
}



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video