<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[hilfe komm nicht auf den fehler]]></title><description><![CDATA[<p>Hallo liebe Foren Mitglieder kann mir jemand sagen wo ich einen fehler gemacht habe ich komm einfach nicht drauf</p>
<pre><code>#include &quot;CommandNewMonster.h&quot;
#include &quot;UserInterface.h&quot;
#include &quot;Monster.h&quot;

#include &lt;string&gt;

CommandNewMonster::CommandNewMonster(UserInterface&amp; ui)
  : cnm_ui(ui)
{
  //cnm_ui = ui;
}

CommandNewMonster::~CommandNewMonster()
{

}

Attack* CommandNewMonster::execute()
{
  std::string name;
  std::string type;
  unsigned int health;
  unsigned int attack;
  unsigned int defense;

  std::string temp;
  overload = true;
  damage_count = 0;

  while(name.empty())
  {
    std::cout&lt;&lt;&quot;Monster Name? &quot;;
    name = cnm_ui.readString();
  }

  while(type.empty())
  {
    std::cout&lt;&lt;&quot;Monster Type? &quot;;
    type = cnm_ui.readString();
  }

  while (overload == true)
    {
    overload == false;

    while(temp.empty())
    {
      std::cout&lt;&lt;&quot;Monster Health? &quot;;
      temp = cnm_ui.readString();
      if(!(cnm_ui.stringToUnsignedInt(temp, health)))
        {
          std::cout&lt;&lt;&quot;Error: Please enter an integer.&quot;&lt;&lt;std::endl;
        }
      else
        {
          if(!(addDamageCounter(damage)))
          {
            temp.clear();
          }
        }
    }
    while (overload == true)
    {
      overload == false;

      while(temp.empty())
      {
        std::cout&lt;&lt;&quot;Monster Attack? &quot;;
        temp = cnm_ui.readString();
        if(!(cnm_ui.stringToUnsignedInt(temp, attack)))
        {
          std::cout&lt;&lt;&quot;Error: Please enter an integer.&quot;&lt;&lt;std::endl;
        }
      else
        {
          if(!(addDamageCounter(damage)))
          {
            temp.clear();
          }
        }
    }
    while (overload == true)
    {
    overload == false;

    while(temp.empty())
    {
      std::cout&lt;&lt;&quot;Monster Defense? &quot;;
      temp = cnm_ui.readString();
      if(!(cnm_ui.stringToUnsignedInt(temp, defense)))
        {
          std::cout&lt;&lt;&quot;Error: Please enter an integer.&quot;&lt;&lt;std::endl;
        }
      else
        {
          if(!(addDamageCounter(damage)))
          {
            temp.clear();
          }
        }
    }
  return &amp;attack;
}

bool CommandNewMonster::addDamageCounter(unsigned int add)
{
  if((damage_count+add)&lt;=150)
    {
      damage_count+=add;
      return true;
    }
  else
  {
    std::cout&lt;&lt;&quot;Error: Monster is too powerful. &quot;&lt;&lt;
      &quot;The sum of status values has to be max. 150 points.&quot;&lt;&lt;std::endl;
    overload = true;
    return false;
  }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/284756/hilfe-komm-nicht-auf-den-fehler</link><generator>RSS for Node</generator><lastBuildDate>Fri, 21 Aug 2026 20:13:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/284756.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 07 Apr 2011 12:10:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to hilfe komm nicht auf den fehler on Thu, 07 Apr 2011 12:10:19 GMT]]></title><description><![CDATA[<p>Hallo liebe Foren Mitglieder kann mir jemand sagen wo ich einen fehler gemacht habe ich komm einfach nicht drauf</p>
<pre><code>#include &quot;CommandNewMonster.h&quot;
#include &quot;UserInterface.h&quot;
#include &quot;Monster.h&quot;

#include &lt;string&gt;

CommandNewMonster::CommandNewMonster(UserInterface&amp; ui)
  : cnm_ui(ui)
{
  //cnm_ui = ui;
}

CommandNewMonster::~CommandNewMonster()
{

}

Attack* CommandNewMonster::execute()
{
  std::string name;
  std::string type;
  unsigned int health;
  unsigned int attack;
  unsigned int defense;

  std::string temp;
  overload = true;
  damage_count = 0;

  while(name.empty())
  {
    std::cout&lt;&lt;&quot;Monster Name? &quot;;
    name = cnm_ui.readString();
  }

  while(type.empty())
  {
    std::cout&lt;&lt;&quot;Monster Type? &quot;;
    type = cnm_ui.readString();
  }

  while (overload == true)
    {
    overload == false;

    while(temp.empty())
    {
      std::cout&lt;&lt;&quot;Monster Health? &quot;;
      temp = cnm_ui.readString();
      if(!(cnm_ui.stringToUnsignedInt(temp, health)))
        {
          std::cout&lt;&lt;&quot;Error: Please enter an integer.&quot;&lt;&lt;std::endl;
        }
      else
        {
          if(!(addDamageCounter(damage)))
          {
            temp.clear();
          }
        }
    }
    while (overload == true)
    {
      overload == false;

      while(temp.empty())
      {
        std::cout&lt;&lt;&quot;Monster Attack? &quot;;
        temp = cnm_ui.readString();
        if(!(cnm_ui.stringToUnsignedInt(temp, attack)))
        {
          std::cout&lt;&lt;&quot;Error: Please enter an integer.&quot;&lt;&lt;std::endl;
        }
      else
        {
          if(!(addDamageCounter(damage)))
          {
            temp.clear();
          }
        }
    }
    while (overload == true)
    {
    overload == false;

    while(temp.empty())
    {
      std::cout&lt;&lt;&quot;Monster Defense? &quot;;
      temp = cnm_ui.readString();
      if(!(cnm_ui.stringToUnsignedInt(temp, defense)))
        {
          std::cout&lt;&lt;&quot;Error: Please enter an integer.&quot;&lt;&lt;std::endl;
        }
      else
        {
          if(!(addDamageCounter(damage)))
          {
            temp.clear();
          }
        }
    }
  return &amp;attack;
}

bool CommandNewMonster::addDamageCounter(unsigned int add)
{
  if((damage_count+add)&lt;=150)
    {
      damage_count+=add;
      return true;
    }
  else
  {
    std::cout&lt;&lt;&quot;Error: Monster is too powerful. &quot;&lt;&lt;
      &quot;The sum of status values has to be max. 150 points.&quot;&lt;&lt;std::endl;
    overload = true;
    return false;
  }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2045973</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2045973</guid><dc:creator><![CDATA[aria00]]></dc:creator><pubDate>Thu, 07 Apr 2011 12:10:19 GMT</pubDate></item><item><title><![CDATA[Reply to hilfe komm nicht auf den fehler on Thu, 07 Apr 2011 12:12:53 GMT]]></title><description><![CDATA[<p>So viel Code, und keine einzige Beschreibung, WAS denn jetzt genau falsch läuft?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2045977</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2045977</guid><dc:creator><![CDATA[Sensai_]]></dc:creator><pubDate>Thu, 07 Apr 2011 12:12:53 GMT</pubDate></item><item><title><![CDATA[Reply to hilfe komm nicht auf den fehler on Thu, 07 Apr 2011 12:17:08 GMT]]></title><description><![CDATA[<p>Und für C/C++-Codetags anstelle von Code-Tags wären wir auch dankbar.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2045980</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2045980</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Thu, 07 Apr 2011 12:17:08 GMT</pubDate></item><item><title><![CDATA[Reply to hilfe komm nicht auf den fehler on Thu, 07 Apr 2011 12:22:19 GMT]]></title><description><![CDATA[<p>Lies dir mal bitte den Link in meiner Signatur durch, und dann stell die Frage nochmal. Und zwar:<br />
- mit [ cpp ]-Tags statt [ code ]-Tags<br />
- mit einem aufs Wesentliche reduzierten Code.<br />
- mit der Fehlermeldung, die du bekommst (oder einer genauen Beschreibung des falschen Verhaltens und des Verhaltens, das du eigentlich erwartest)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2045982</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2045982</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Thu, 07 Apr 2011 12:22:19 GMT</pubDate></item><item><title><![CDATA[Reply to hilfe komm nicht auf den fehler on Thu, 07 Apr 2011 12:26:58 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &quot;CommandNewMonster.h&quot;
#include &quot;UserInterface.h&quot;
#include &quot;Monster.h&quot;

#include &lt;string&gt;

CommandNewMonster::CommandNewMonster(UserInterface&amp; ui)
  : cnm_ui(ui)
{
  //cnm_ui = ui;
}

CommandNewMonster::~CommandNewMonster()
{

}

Attack* CommandNewMonster::execute()
{
  std::string name;
  std::string type;
  unsigned int health;
  unsigned int attack;
  unsigned int defense;

  std::string temp;
  overload = true;
  damage_count = 0;

  while(name.empty())
  {
    std::cout&lt;&lt;&quot;Monster Name? &quot;;
    name = cnm_ui.readString();
  }

  while(type.empty())
  {
    std::cout&lt;&lt;&quot;Monster Type? &quot;;
    type = cnm_ui.readString();
  }

  while (overload == true)
    {
    overload == false;

    while(temp.empty())
    {
      std::cout&lt;&lt;&quot;Monster Health? &quot;;
      temp = cnm_ui.readString();
      if(!(cnm_ui.stringToUnsignedInt(temp, health)))
        {
          std::cout&lt;&lt;&quot;Error: Please enter an integer.&quot;&lt;&lt;std::endl;
        }
      else
        {
          if(!(addDamageCounter(damage)))
          {
            temp.clear();
          }
        }
    }
    while (overload == true)
    {
      overload == false;

      while(temp.empty())
      {
        std::cout&lt;&lt;&quot;Monster Attack? &quot;;
        temp = cnm_ui.readString();
        if(!(cnm_ui.stringToUnsignedInt(temp, attack)))
        {
          std::cout&lt;&lt;&quot;Error: Please enter an integer.&quot;&lt;&lt;std::endl;
        }
      else
        {
          if(!(addDamageCounter(damage)))
          {
            temp.clear();
          }
        }
    }
    while (overload == true)
    {
    overload == false;

    while(temp.empty())
    {
      std::cout&lt;&lt;&quot;Monster Defense? &quot;;
      temp = cnm_ui.readString();
      if(!(cnm_ui.stringToUnsignedInt(temp, defense)))
        {
          std::cout&lt;&lt;&quot;Error: Please enter an integer.&quot;&lt;&lt;std::endl;
        }
      else
        {
          if(!(addDamageCounter(damage)))
          {
            temp.clear();
          }
        }
    }
  return &amp;attack;
}

bool CommandNewMonster::addDamageCounter(unsigned int add)
{
  if((damage_count+add)&lt;=150)
    {
      damage_count+=add;
      return true;
    }
  else
  {
    std::cout&lt;&lt;&quot;Error: Monster is too powerful. &quot;&lt;&lt;
      &quot;The sum of status values has to be max. 150 points.&quot;&lt;&lt;std::endl;
    overload = true;
    return false;
  }
}
</code></pre>
<p>es dient rein zur erstellung von mostern in dem das programm den user nach name, typ, gesundheit, angrif und verteidigung abfragt. bei den ersten 2 fragt er nach einem string und bei den anderen einen unsigned int wobei die summe der 3 werte welche der user eingibt nicht 150 punkte übersteigen dürfen</p>
<p>sorry bin ein anfänger und kenn mich noch nicht so gut aus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2045987</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2045987</guid><dc:creator><![CDATA[aria00]]></dc:creator><pubDate>Thu, 07 Apr 2011 12:26:58 GMT</pubDate></item><item><title><![CDATA[Reply to hilfe komm nicht auf den fehler on Thu, 07 Apr 2011 12:33:10 GMT]]></title><description><![CDATA[<p>Gut - was genau nun nicht funktionier wissen wir immernoch nicht.<br />
Aber Möglicherweise ja folgendes:</p>
<p>Dein Programm fragt unaufhörlich nach den Lebenspunkten, der Monster-Angriffskraft und der Verteidigungs-rate?</p>
<p>Grund dafür: Zeile 44<br />
Du weist overload nirgends einen anderen Wert zu, somit bleibt overload immer true.</p>
<p>overload == false ist keine Zuweisung!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2045990</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2045990</guid><dc:creator><![CDATA[inter2k3]]></dc:creator><pubDate>Thu, 07 Apr 2011 12:33:10 GMT</pubDate></item><item><title><![CDATA[Reply to hilfe komm nicht auf den fehler on Thu, 07 Apr 2011 12:34:50 GMT]]></title><description><![CDATA[<p>aria00 schrieb:</p>
<blockquote>
<p>sorry bin ein anfänger und kenn mich noch nicht so gut aus</p>
</blockquote>
<p>Eine sinnvolle Beschreibung des Fehlers solltest du dennoch hinbekommen:</p>
<p>1. Fehlermeldung vom Compiler, wenn zutreffen angeben.<br />
(Auf die ersten paar Beschränken, da häufig Folgefehler)</p>
<p>2. Was erwartest du von dem Programm, und was passiert tatsächlich.<br />
(Wir wissen noch immer nicht was du von uns willst)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2045992</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2045992</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Thu, 07 Apr 2011 12:34:50 GMT</pubDate></item></channel></rss>