• Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Some help in coding.

killer-curry

Oro.........?
  • 2,521
    Posts
    9
    Years
    Well, I been doing assignment about pokemon simulator and this problem occurs when comes to this part
    Spoiler:


    so , at the underline part, when i press yes the program said there is another process using so somehow i cannot continue and bold part is when I press N the rest of the process is ignored and goes to exit.

    I do hope someone can help me to fix it, thank you very much to reply!
     
    Also I notice you're using
    Code:
    if (choice == 'y' && choice == 'Y')
    and
    Code:
    if (choice == 'n' && choice == 'N')
    Those don't make sense. && is the AND statement, and it's not possible for the choice to be both Y and y. Replace the && with a || to turn it into an OR statement.

    In most languages, you could simplify that by doing something like
    Code:
    if (choice.toLowerCase()=="y")
    but I'm pretty sure C lacks that function :(
     
    Last edited:
    Back
    Top