Text-based RPG game in C++ This is a text-based RPG game I've made in C++ and would love some review on it. I am a 100% complete newbie with maybe 2 weeks of C++ experience so I'd love some lessons on what I did wrong and how I can improve! I mainly just use a lot of switch statements and if statements.

If there is anything wrong or things that could change and improve I'd very much appreciate if you could walk me through what was wrong, why it was wrong and how to prevent it from happening again. I really don't know a lot of C++ terms so ELIF would be awesome.

Here's my simple main.cpp. I think that's called a constructor and I'm using it to call my MeadowGiant.cpp down the road.

#include &lt;iostream&gt;
#include &lt;string&gt;
#include "MeadowGiant.h"

int main()
{
MeadowGiant obj1;
}


MeadowGiant.h

#define MEADOWGIANT_H

class MeadowGiant
{
public:
    MeadowGiant();
protected:
};

#endif


MeadowGiant.cpp

#include "MeadowGiant.h"
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;time.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

MeadowGiant::MeadowGiant()
{
int trail, caveEnter;
int fight1;
int loot;
int goblinAttack, goblinHP, HP, attack, action1, ability; 
goblinAttack = 5;
goblinHP = 10;
HP = 100;

std::cout &lt;&lt; -Insert story narrative- Choose a trail to go down.\n";
std::cin  &gt;&gt; trail; 

    if(trail==1)
    {
    std::cout &lt;&lt; "-Insert story narrative- Come across a cave. Do you go in?\n";
    std::cin  &gt;&gt; caveEnter;

        if(caveEnter==1)
        {
        std::cout &lt;&lt; "You are ambushed by a goblin. Run or fight?\n";
        std::cin &gt;&gt; fight1;

        goblinFight:
        loot = rand() % 4 + 1;
        srand(time(NULL));           

        if(fight1==1)
        {
        std::cout   &lt;&lt; "Your HP: " &lt;&lt; HP &lt;&lt; std::endl;
        std::cout   &lt;&lt; "Enemy HP: " &lt;&lt; goblinHP &lt;&lt; std::endl;
        std::cout   &lt;&lt; "What do you do?\n
                    &lt;&lt; "[1] Attack [2] Run \n";
        std::cin    &gt;&gt; action1;
        }
            if(goblinHP&lt;=0)
            {
            std::cout &lt;&lt; "You have slain the goblin!\n" 
                      &lt;&lt; "You head towards the chest and take the spoils\n"
                      &lt;&lt; "of battle!\n";
                 switch(loot)
            {
            case 1: std::cout &lt;&lt; "You find a bastard sword!\n";
                              attack = attack + 7;
                              goto exitCave;
            case 2: std::cout &lt;&lt; "You find an Enchanted Staff!\n";
                              attack = attack + 10;
                              goto exitCave;
            case 3: std::cout &lt;&lt; "You find an Obsidian Dagger!\n";
                              attack = attack + 9;
                              goto exitCave;
            case 4: std::cout &lt;&lt; "You find a Holy Mace!\n";
                              attack = attack + 10;
                              goto exitCave;
            }
    else if(action1==1)
    {
    std::cout   &lt;&lt; "You successfully hit the goblin!\n"
                &lt;&lt; "He strikes back!\n";
    attack = rand() % 10 + 1;  
    srand(time(NULL));

    goblinHP = goblinHP - attack;
    HP = HP - goblinAttack;
    goto goblinFight;
    }
    else if(action==2)
    {
    std::cout   &lt;&lt; "You take the cowards way out and leave the cave.\n";
    goto exitCave;
    }
    }
else if(caveEnter==2)
{
exitCave:
std::cout &lt;&lt; "You have exited the cave.\n";
} 
else
{
goto exitCave;
}
}
}


The format of my actual code doesn't look like this in my IDE. The code is the same, but the tabs are much cleaner in my compiler so if that's an issue, I'm already on it.
There are a number of things that I see that may help you improve your code.

Fix typos

There were so many typos in this code that I had to do quite a number of fixes before the code would even compile.  I'd recommend composing the question offline, using a text editor that changes tabs to spaces. Then cut and paste the whole thing into CodeReview.  It will save many people lots of time, including and especially you!

Don't put everything into the constructor

The MeadowGiant class has all of its code in the constructor.  That's not very good design.  Instead, it would be better to instantiate one or more of them and then use member functions to manipulate the object.

Use only necessary #includes

The #include &lt;stdio.h&gt; line is not necessary and can be safely removed.

Don't reseed the random number generator more than once

The program currently calls srand after every call to rand().  This is really neither necessary nor advisable.  Instead, just call it once when the program begins and then continue to use rand() to get random numbers.  Better yet, see the next suggestion.

Consider using a better random number generator

If you are using a compiler that supports at least C++11, consider using a better random number generator.  In particular, instead of rand, you might want to look at std::uniform_real_distribution and friends in the &lt;random&gt; header.

Use constant string concatenation

This code currently has a number of instances that look like this (or would if the typos were fixed):

std::cout &lt;&lt; "You have slain the goblin!\n"
    &lt;&lt; "You head towards the chest and take the spoils\n"
    &lt;&lt; "of battle!\n";


This calls the &lt;&lt; operator three times.  Instead, you could write this:

std::cout &lt;&lt; "You have slain the goblin!\n"
    "You head towards the chest and take the spoils\n"
    "of battle!\n";


This only calls &lt;&lt; once.  The compiler automatically concatenates the string literals together.

Avoid using goto

Having a proliferation of goto statements is usually a sign of bad design.  Better would be to eliminate them entirely -- it makes the code easier to follow and less error-prone.  In this code, it's probable that you could use a loop instead:

for (goblinHP = 10; goblinHP &gt; 0; ) {
    // code to implement goblin attack goes here
}


Use C++-style includes

Instead of including stdlib.h you should instead use #include &lt;cstdlib&gt;.  The difference is in namespaces as you can read about in this question.

Eliminate unused variables

Unused variables are a sign of poor quality code, and you don't want to write poor quality code. In this code, ability is unused.  Your compiler is smart enough to tell you about this if you ask it nicely.