Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8212501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:46:46+00:00 2026-06-07T10:46:46+00:00

switch(ch) { //input a number case ‘1’: case ‘2’: case ‘3’: case ‘4’: case

  • 0
switch(ch)
{
        //input a number
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
        case '8':
        case '9':
            if(check_original())
            {
                int y = g.y;
                int x = g.x;

                g.board[g.y][g.x] = ch - '0';
                draw_numbers();

                g.y = y;
                g.x = x;
                show_cursor();
             }

        // delete an input from the board
        case '0':
        case KEY_BACKSPACE:
        case KEY_DC:
            if(check_original())
            {
                    int y = g.y;
                    int x = g.x;

                    g.board[y][x] = 0;
                    draw_numbers();

                    g.y = y;
                    g.x = x;
                    show_cursor();
            }
}

Problem: Case ‘1’ through case ‘9’ worked fine. Then I added case ‘0’, case KEY_BACKSPACE and case KEY_DC. Although it compiles, none of the cases now work, including cases ‘1’ – ‘9’. What am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:46:47+00:00Added an answer on June 7, 2026 at 10:46 am

    All of your cases are falling through. I assume that you should have a break; before case 0:.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

// get user's input int ch = getch(); switch (ch) { //input a number
I have a switch case statement that doesn't work. I've checked the input, it's
In case 5 of the switch statement below I'd like the user to input
I want to switch a file upload from FTP to SFTP. But I cannot
I know that switch / select statements break automatically after every case. I am
I'm building a class with a number of input validations, and I've decided to
I am trying to setup a comparison based on input from a file (ie
How do I read in a variable number of characters? The user can input
I want to use the users input from the edit text, covert it into
I am working on a homework assignment, beginning C#. Have to accept input from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.