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

  • SEARCH
  • Home
  • 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 8177847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:37:22+00:00 2026-06-06T23:37:22+00:00

My problem is that this function returns guess as the sum of 97 and

  • 0

My problem is that this function returns guess as the sum of 97 and y, instead of just the letter, as the switch statement is instructing it to. The weird thing is, when I have it just return y, it is working exactly as I would expect it to. For example, when y=4, and i have it return y, 4 is displayed. When y=4 and ‘guess’ is returned, 101 is displayed. Disclaimer: this is not the full code. It’s really long, and I think superfluous, as the only problem I have is when this specific function returns ‘guess’, not even when it returns y. If all the code would be useful though, i would be happy to put it up.

int letterguess(int z){
char guess;
int y;

y=letters[0][z];

switch (y){
            case 0:
                guess='a';
                break;
            case 1:
                guess='b';
                break;
            case 2:
                guess='c';
                break;
            case 3:
                guess='d';
                break;
            case 4:
                guess='e';
                break;
            case 5:
                guess='f';
                break;
            case 6:
                guess='g';
                break;
            case 7:
                guess='h';
                break;
            case 8:
                guess='i';
                break;
            case 9:
                guess='j';
                break;
            case 10:
                guess='k';
                break;
            case 11:
                guess='l';
                break;
            case 12:
                guess='m';
                break;
            case 13:
                guess='n';
                break;
            case 14:
                guess='o';
                break;
            case 15:
                guess='p';
                break;
            case 16:
                guess='q';
                break;
            case 17:
                guess='r';
                break;
            case 18:
                guess='s';
                break;
            case 19:
                guess='t';
                break;
            case 20:
                guess='u';
                break;
            case 21:
                guess='v';
                break;
            case 22:
                guess='w';
                break;
            case 23:
                guess='y';
                break;
            case 24:
                guess='y';
                break;
            case 25:
                guess='z';
                break;

        }

        return guess;

}

I really cannot see how this possibly could get messed up like this. Thanks in advance.

  • 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-06T23:37:23+00:00Added an answer on June 6, 2026 at 11:37 pm

    Change this:

    int letterguess(int z)
    

    to this:

    char letterguess(int z)
    

    Then when you output the return value you’ll get the letter instead of its numerical value.

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

Sidebar

Related Questions

I've used this useful JQuery function that serializes nested elements. the problem is how
I'm having a problem with using this in js. I have a function that
This is really weird problem. I just installed Node.JS on my system (Fedora). I
I have a problem with a javascript set of functions that I made. This
In the end, I have decided that this isn't a problem that I particularly
I have this problem that I can ref a button for control it. I
I think that this problem can be sorted using reflection (a technology which I'm
I have this problem that my sites uses alot of ajax and when a
There was this problem that has been asked about implementing a load byte into
Ok I have this problem that I've never had before, it's really bugging me.

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.