Ask coding questions

← Back to all posts
0
C++ Help Please
AmatuerHour (0)

https://repl.it/@AmatuerHour/Lil-Mac
Why do I get unused errors? Everything I can think of won't work.

Commentshotnewtop
1
1
malvoliothegood (83)

Line 36 should be: if (planet >= 1 && planet <= 6)

1
mwilki7 (108)

I've never seen
if (planet == (1,2,3,4,5,6))
before
Did you mean to do

for (int i = 1; i <= 6; i++)
{
    if (planet == i)
    {
        std::cout << "You now weigh " << weight << " pounds!\n";
        break;
    }
}

Also take

else
{
    std::cout << "You blast off into space, never to be seen again!\n";
    std::cout << "You awaken twenty years after being blasted off into space. You've landed on a preivously unknown planet. The world is full of towering plants of an imense range of colours. From dark brown to the lightest of reds these plants surround you forming a dark, yet soothing atmosphere. As you look around you can pick up either a stick. number one, a broken knife. number two, or an odd looking plant. number three. Which will you pick up?\n";
    std::cin >> answer1;
      if (answer1 == 1) {
        std::cout << "You pick up the stick. Nothing appears to be unusual about it, until you try to let go of the stick. The stick is stuck to your hand, and you soon feel a sharp pain erupting from the contact point. You try to pry the stick off but it only digs deeper into your hand. The stick seems to grow larger the longer it's attached. Within a mater of seconds you feel light headed and are bashed in the head with a piece of timber rivaling that of an ancient oak.\n";
    }
}

Out of the else statement and it should work