-6
#include <iostream>

using namespace std;

int main()
{
    //setting values for the items and characters
    {
        int player;
        int healthvalue = 100;
        int sword;
        int enemy1;
        int enemy2;
        std::cout << "Hello player! Welcome to the game!\n\t";
    }
    {
        std::cout << "You wake up in confusion, your whereabouts are unknown.\n"
                  << std::endl;

        std::cout << "A band of goblins approachs you from the distant horizon.\n\t" << std::endl;
        std::cout << "Do you draw your sword and stand your ground?\n";
        cin >> yes, no;
        if (true) {
        }
    }
}

this is what we have so far. We are trying to enable yes and no options. and later on we might try movement options. Can any one help us with this? it will be greatly appreciated.

drescherjm
  • 10,365
  • 5
  • 44
  • 64
MSan
  • 1
  • 1
  • 10
    `cin>>yes, no;` doesn't do what you think it does. Please start learning the basics from one of [these books](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) before starting to ask quesitons here. – user0042 Nov 20 '17 at 15:17
  • 1
    You will soon regret puting parts of code in different scopes – Killzone Kid Nov 20 '17 at 15:21
  • @KillzoneKid In this specific piece of code as it is now. Using functions and scopes is not generally bad. – nwp Nov 20 '17 at 15:31
  • @nwp didnt say it was bad practice, but in this particular case I doubt OP even knows why he did it – Killzone Kid Nov 20 '17 at 15:38

1 Answers1

1

Here is what you need to do:

  1. read input from console as string.
  2. compare read input with the strings "yes" and "no"
  3. take action depending on the comparison result
bolov
  • 72,283
  • 15
  • 145
  • 224