Changing integers in classes C++
<p>Okay, so, I am storing a public integer in a class, like this:</p>

<pre><code>class varglobalness{
    public:

    int xp;
    int lvl;
    int xpt;
    int hp;

};
</code></pre>

<p>and, inside of a function I am trying to change the variables by doing this:</p>

<pre><code>v.lvl += 1;
v.xpt += rand()%25+25;
v.xp = 0;
v.hp += rand()%25+5;
</code></pre>

<p>When I do this, though, hp doesn't change, xp does change to 0, but xpt and lvl changes to a lot of random numbers.</p>

<p>Any idea how I can properly change these integers without this happening? </p>
