<?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 Endlosschleife]]></title><description><![CDATA[<p>Der code funktioniert soweit, nur das menue macht Probleme, denn beim 1. click passiert nix. Beim 2. click läuft die Endlosschleife!<br />
Warum <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>// Declarations added here will be included at the top of the .HPP file</p>
<pre><code class="language-cpp">class __Form1_declspec Form1 : public __Form1_Base
{

    public:
        // add your public instance data here

    private:
         WBool _Set_Text(void); // add your private instance data here
         WInt _text_nr;
         WInt _DeuEng;
         WInt _um1;
          WInt i;
    protected:
        // add your protected instance data here

};

// Code added here will be included at the top of the .CPP file
 WBool Form1::_Set_Text(void)
 {

    _um1=(_um1+1)%4;

  switch (_um1)
    {
     case 0:
           label_1-&gt;SetText( &quot;1 Text Position&quot; );
           label_2-&gt;SetText( &quot; &quot; );
           label_3-&gt;SetText( &quot; &quot; );
           label_4-&gt;SetText( &quot; &quot; );
       break;
       case 1:

            label_1-&gt;SetText( &quot;&quot; );
            label_2-&gt;SetText( &quot;2 Text Position &quot; );
            label_3-&gt;SetText( &quot;&quot; );
            label_4-&gt;SetText( &quot; &quot; );

       break;
      case 2:

           label_1-&gt;SetText( &quot;&quot; );
           label_2-&gt;SetText( &quot;&quot; );
           label_3-&gt;SetText( &quot;  3 Text Position &quot; );
           label_4-&gt;SetText( &quot;  &quot; );

      break;
       case 3:

            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot; &quot; );
            label_3-&gt;SetText( &quot; &quot; );
            label_4-&gt;SetText( &quot;4 Text Position &quot; );

      break; 

    }
  return FALSE;
   }

//  Include definitions for resources.
#include &quot;WRes.h&quot;

Form1::Form1()
{
 _text_nr = 0;          
 _DeuEng  = 0;
 i = 0;
}

Form1::~Form1()
{

}

WBool Form1::menu_1_ErstePosition_Click(
    WObject *           source,
    WEventData *        event )
{
           label_1-&gt;SetText( &quot;1 Text Position &quot; );
           label_2-&gt;SetText( &quot; &quot; );
           label_3-&gt;SetText( &quot; &quot; );
           label_4-&gt;SetText( &quot; &quot; );
             if (_text_nr == 0 &amp; _DeuEng == 0)
{ _um1 = 0;}
    return FALSE;
}

WBool Form1::menu_1_ZweitePosition_Click(
    WObject *           source,
    WEventData *        event )
{
            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot;2 Text Position &quot; );
            label_3-&gt;SetText( &quot; &quot; );
            label_4-&gt;SetText( &quot; &quot; );
        if (_text_nr == 0 &amp; _DeuEng == 0)
{ _um1 = 1;}
    return FALSE;
}

WBool Form1::menu_1_DrittePosition_Click(
    WObject *           source,
    WEventData *        event )
{
            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot; &quot; );
            label_3-&gt;SetText( &quot; 3 Text Position&quot; );
            label_4-&gt;SetText( &quot; &quot; );
        if (_text_nr == 0 &amp; _DeuEng == 0)
{ _um1 = 2;}
    return FALSE;
}

WBool Form1::menu_1_ViertePosition_Click(
    WObject *           source,
    WEventData *        event )
{
            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot; &quot; );
            label_3-&gt;SetText( &quot; &quot; );
            label_4-&gt;SetText( &quot; 4 Text Position&quot; ); 
        if (_text_nr == 0 &amp; _DeuEng == 0)
{_um1 = 3; }
    return FALSE;
}

WBool Form1::menu_1_Start_Click(
    WObject *           source,
    WEventData *        event )
{
do // ----&gt;ENDLOSSCHLEIFE :rage:  :rage:  :rage:  :rage: 
{
    if (_text_nr == 1)
_text_nr =0;

 else  
 _text_nr = 1;

_text_nr ++;
_Set_Text();
_Set_Text();

}

while (_um1 &gt; 0);
{
_DeuEng ++;

 _Set_Text();
 if(_um1&gt;=3)
 _Set_Text();

}
return FALSE;

}

WBool Form1::cb_1_Click(
    WObject *           source,
    WEventData *        event )
{
    if (_text_nr == 0)
_text_nr = 0;

 else  
 _text_nr = 1;

_Set_Text();

 return FALSE;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/145441/hilfe-endlosschleife</link><generator>RSS for Node</generator><lastBuildDate>Thu, 03 Sep 2026 06:28:01 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/145441.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 27 Apr 2006 19:58:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hilfe Endlosschleife on Thu, 27 Apr 2006 19:58:12 GMT]]></title><description><![CDATA[<p>Der code funktioniert soweit, nur das menue macht Probleme, denn beim 1. click passiert nix. Beim 2. click läuft die Endlosschleife!<br />
Warum <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>// Declarations added here will be included at the top of the .HPP file</p>
<pre><code class="language-cpp">class __Form1_declspec Form1 : public __Form1_Base
{

    public:
        // add your public instance data here

    private:
         WBool _Set_Text(void); // add your private instance data here
         WInt _text_nr;
         WInt _DeuEng;
         WInt _um1;
          WInt i;
    protected:
        // add your protected instance data here

};

// Code added here will be included at the top of the .CPP file
 WBool Form1::_Set_Text(void)
 {

    _um1=(_um1+1)%4;

  switch (_um1)
    {
     case 0:
           label_1-&gt;SetText( &quot;1 Text Position&quot; );
           label_2-&gt;SetText( &quot; &quot; );
           label_3-&gt;SetText( &quot; &quot; );
           label_4-&gt;SetText( &quot; &quot; );
       break;
       case 1:

            label_1-&gt;SetText( &quot;&quot; );
            label_2-&gt;SetText( &quot;2 Text Position &quot; );
            label_3-&gt;SetText( &quot;&quot; );
            label_4-&gt;SetText( &quot; &quot; );

       break;
      case 2:

           label_1-&gt;SetText( &quot;&quot; );
           label_2-&gt;SetText( &quot;&quot; );
           label_3-&gt;SetText( &quot;  3 Text Position &quot; );
           label_4-&gt;SetText( &quot;  &quot; );

      break;
       case 3:

            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot; &quot; );
            label_3-&gt;SetText( &quot; &quot; );
            label_4-&gt;SetText( &quot;4 Text Position &quot; );

      break; 

    }
  return FALSE;
   }

//  Include definitions for resources.
#include &quot;WRes.h&quot;

Form1::Form1()
{
 _text_nr = 0;          
 _DeuEng  = 0;
 i = 0;
}

Form1::~Form1()
{

}

WBool Form1::menu_1_ErstePosition_Click(
    WObject *           source,
    WEventData *        event )
{
           label_1-&gt;SetText( &quot;1 Text Position &quot; );
           label_2-&gt;SetText( &quot; &quot; );
           label_3-&gt;SetText( &quot; &quot; );
           label_4-&gt;SetText( &quot; &quot; );
             if (_text_nr == 0 &amp; _DeuEng == 0)
{ _um1 = 0;}
    return FALSE;
}

WBool Form1::menu_1_ZweitePosition_Click(
    WObject *           source,
    WEventData *        event )
{
            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot;2 Text Position &quot; );
            label_3-&gt;SetText( &quot; &quot; );
            label_4-&gt;SetText( &quot; &quot; );
        if (_text_nr == 0 &amp; _DeuEng == 0)
{ _um1 = 1;}
    return FALSE;
}

WBool Form1::menu_1_DrittePosition_Click(
    WObject *           source,
    WEventData *        event )
{
            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot; &quot; );
            label_3-&gt;SetText( &quot; 3 Text Position&quot; );
            label_4-&gt;SetText( &quot; &quot; );
        if (_text_nr == 0 &amp; _DeuEng == 0)
{ _um1 = 2;}
    return FALSE;
}

WBool Form1::menu_1_ViertePosition_Click(
    WObject *           source,
    WEventData *        event )
{
            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot; &quot; );
            label_3-&gt;SetText( &quot; &quot; );
            label_4-&gt;SetText( &quot; 4 Text Position&quot; ); 
        if (_text_nr == 0 &amp; _DeuEng == 0)
{_um1 = 3; }
    return FALSE;
}

WBool Form1::menu_1_Start_Click(
    WObject *           source,
    WEventData *        event )
{
do // ----&gt;ENDLOSSCHLEIFE :rage:  :rage:  :rage:  :rage: 
{
    if (_text_nr == 1)
_text_nr =0;

 else  
 _text_nr = 1;

_text_nr ++;
_Set_Text();
_Set_Text();

}

while (_um1 &gt; 0);
{
_DeuEng ++;

 _Set_Text();
 if(_um1&gt;=3)
 _Set_Text();

}
return FALSE;

}

WBool Form1::cb_1_Click(
    WObject *           source,
    WEventData *        event )
{
    if (_text_nr == 0)
_text_nr = 0;

 else  
 _text_nr = 1;

_Set_Text();

 return FALSE;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1046732</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1046732</guid><dc:creator><![CDATA[Renate]]></dc:creator><pubDate>Thu, 27 Apr 2006 19:58:12 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe Endlosschleife on Fri, 28 Apr 2006 07:04:28 GMT]]></title><description><![CDATA[<p>hast dir schonmal _uml im debugger angeschaut?</p>
<p>weiß jetzt bei deiner IDE nicht, aber du arbeitest mit _uml, ohne das sie jemans initialisiert wurde (oder ich habs übersehen), und hat somit einen zufallswert (der mit +1 und % 4 wohl trotzdem immer größer 0 sein wird)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1046857</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1046857</guid><dc:creator><![CDATA[ser1al]]></dc:creator><pubDate>Fri, 28 Apr 2006 07:04:28 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe Endlosschleife on Fri, 28 Apr 2006 08:41:51 GMT]]></title><description><![CDATA[<p>ser1al schrieb:</p>
<blockquote>
<p>hast dir schonmal _uml im debugger angeschaut?</p>
<p>weiß jetzt bei deiner IDE nicht, aber du arbeitest mit _uml, ohne das sie jemans initialisiert wurde (oder ich habs übersehen), und hat somit einen zufallswert (der mit +1 und % 4 wohl trotzdem immer größer 0 sein wird)</p>
</blockquote>
<p>Die Variable heißt: _um1(1=die Ziffer eins)<br />
GrußRenate <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1046909</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1046909</guid><dc:creator><![CDATA[Renate]]></dc:creator><pubDate>Fri, 28 Apr 2006 08:41:51 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe Endlosschleife on Fri, 28 Apr 2006 09:00:58 GMT]]></title><description><![CDATA[<p>Keine Ahnung was dabei rauskommt du verwendest den falschen &amp; operator auf jeden Fall ist es unschön. Es sollte</p>
<pre><code>if (_text_nr == 0 &amp;&amp; _DeuEng == 0) 
    { _um1 = 0;}
</code></pre>
<p>sein.<br />
Kurt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1046922</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1046922</guid><dc:creator><![CDATA[ZuK]]></dc:creator><pubDate>Fri, 28 Apr 2006 09:00:58 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe Endlosschleife on Fri, 28 Apr 2006 09:22:54 GMT]]></title><description><![CDATA[<p>Die Endlosschleife:</p>
<pre><code class="language-cpp">do // ----&gt;ENDLOSSCHLEIFE :rage:  :rage:  :rage:  :rage: 
{
    if (_text_nr == 1)
_text_nr =0;

 else  
 _text_nr = 1;

_text_nr ++;
_Set_Text();
_Set_Text();

}

while (_um1 &gt; 0);
</code></pre>
<p>Schleife läuft also solange bis _um1 0 oder kleiner wird. Was passiert nun in _Set_Text()?</p>
<pre><code class="language-cpp">_um1=(_um1+1)%4;
</code></pre>
<p>So, zu was führt das nun, wenn _um1 beim Eintritt in die Schleife den Wert 1 hat? Richtig:</p>
<p>do<br />
-&gt; _Set_Text (_um1 wird 2)<br />
-&gt; _Set_Text (_um1 wird 3)<br />
-&gt; Bedingung (3 <strong>ist</strong> &gt; 0)</p>
<p>-&gt; _Set_Text (_um1 wird 0)<br />
-&gt; _Set_Text (_um1 wird 1)<br />
-&gt; Bedingung (1 <strong>ist</strong> &gt; 0)</p>
<p>-&gt; goto do <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>........ die Bedingung wird niemals false sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1046938</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1046938</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Fri, 28 Apr 2006 09:22:54 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe Endlosschleife on Fri, 28 Apr 2006 16:46:40 GMT]]></title><description><![CDATA[<p>ZuK schrieb:</p>
<blockquote>
<p>Keine Ahnung was dabei rauskommt du verwendest den falschen &amp; operator auf jeden Fall ist es unschön. Es sollte</p>
<pre><code>if (_text_nr == 0 &amp;&amp; _DeuEng == 0) 
    { _um1 = 0;}
</code></pre>
<p>sein.<br />
Kurt</p>
</blockquote>
<p>Hallo Kurt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> ,<br />
ich habe meinen code kräftig überarbeitet und nun ist er &quot;schöner&quot;, oder???<br />
Nur noch 2 Variablen und alles ist weg, was nicht nötig war.<br />
Die wichtige Stelle ist mit /********************/ gekennzeichnet und hier ist sie nochmal:</p>
<p>// Declarations added here will be included at the top of the .HPP file</p>
<pre><code class="language-cpp">class __Form1_declspec Form1 : public __Form1_Base
{

    public:
        // add your public instance data here

    private:
         WBool _Set_Text(void); // add your private instance data here
         WInt _text_nr;
         WInt _um1;

    protected:
        // add your protected instance data here

};

// Code added here will be included at the top of the .CPP file
 WBool Form1::_Set_Text(void)
 {

    _um1=(_um1+1)%4;

  switch (_um1)
    {
     case 0:
           label_1-&gt;SetText( &quot;1 Text Position&quot; );
           label_2-&gt;SetText( &quot; &quot; );
           label_3-&gt;SetText( &quot; &quot; );
           label_4-&gt;SetText( &quot; &quot; );
       break;
       case 1:

            label_1-&gt;SetText( &quot;&quot; );
            label_2-&gt;SetText( &quot;2 Text Position &quot; );
            label_3-&gt;SetText( &quot;&quot; );
            label_4-&gt;SetText( &quot; &quot; );

       break;
      case 2:

           label_1-&gt;SetText( &quot;&quot; );
           label_2-&gt;SetText( &quot;&quot; );
           label_3-&gt;SetText( &quot;  3 Text Position &quot; );
           label_4-&gt;SetText( &quot;  &quot; );

      break;
       case 3:

            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot; &quot; );
            label_3-&gt;SetText( &quot; &quot; );
            label_4-&gt;SetText( &quot;4 Text Position &quot; );

      break; 

    }
  return FALSE;
   }

//  Include definitions for resources.
#include &quot;WRes.h&quot;

Form1::Form1()
{
 _text_nr = 0;

}

Form1::~Form1()
{

}

WBool Form1::menu_1_ErstePosition_Click(
    WObject *           source,
    WEventData *        event )
{
           label_1-&gt;SetText( &quot;1 Text Position &quot; );
           label_2-&gt;SetText( &quot; &quot; );
           label_3-&gt;SetText( &quot; &quot; );
           label_4-&gt;SetText( &quot; &quot; );
             if (_text_nr == 0 ) 
{ _um1 = 0;}
    return FALSE;
}

WBool Form1::menu_1_ZweitePosition_Click(
    WObject *           source,
    WEventData *        event )
{
            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot;2 Text Position &quot; );
            label_3-&gt;SetText( &quot; &quot; );
            label_4-&gt;SetText( &quot; &quot; );
        if (_text_nr == 0  ) 
{ _um1 = 1;}
    return FALSE;
}

WBool Form1::menu_1_DrittePosition_Click(
    WObject *           source,
    WEventData *        event )
{
            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot; &quot; );
            label_3-&gt;SetText( &quot; 3 Text Position&quot; );
            label_4-&gt;SetText( &quot; &quot; );
        if (_text_nr == 0 )  
{ _um1 = 2;}
    return FALSE;
}

WBool Form1::menu_1_ViertePosition_Click(
    WObject *           source,
    WEventData *        event )
{
            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot; &quot; );
            label_3-&gt;SetText( &quot; &quot; );
            label_4-&gt;SetText( &quot; 4 Text Position&quot; ); 
        if (_text_nr == 0 ) 
             {_um1 = 3; }
    return FALSE;
}
/* ************************************ */

WBool Form1::menu_1_Start_Click(
    WObject *           source,
    WEventData *        event )
{

if (_text_nr == 1)
    _text_nr =0;
    _Set_Text();
return FALSE;

}
/* *********************************  */

WBool Form1::cb_1_Click(
    WObject *           source,
    WEventData *        event )
{

 if (_text_nr == 1)
     _text_nr = 0;
     _Set_Text();

 return FALSE;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1047195</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1047195</guid><dc:creator><![CDATA[Renate]]></dc:creator><pubDate>Fri, 28 Apr 2006 16:46:40 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe Endlosschleife on Fri, 28 Apr 2006 16:59:17 GMT]]></title><description><![CDATA[<p>LordJaxom schrieb:</p>
<blockquote>
<p>Die Endlosschleife:</p>
<pre><code class="language-cpp">do // ----&gt;ENDLOSSCHLEIFE :rage:  :rage:  :rage:  :rage: 
{
    if (_text_nr == 1)
_text_nr =0;

 else  
 _text_nr = 1;

_text_nr ++;
_Set_Text();
_Set_Text();

}

while (_um1 &gt; 0);
</code></pre>
<p>Schleife läuft also solange bis _um1 0 oder kleiner wird. Was passiert nun in _Set_Text()?</p>
<pre><code class="language-cpp">_um1=(_um1+1)%4;
</code></pre>
<p>So, zu was führt das nun, wenn _um1 beim Eintritt in die Schleife den Wert 1 hat? Richtig:</p>
<p>do<br />
-&gt; _Set_Text (_um1 wird 2)<br />
-&gt; _Set_Text (_um1 wird 3)<br />
-&gt; Bedingung (3 <strong>ist</strong> &gt; 0)</p>
<p>-&gt; _Set_Text (_um1 wird 0)<br />
-&gt; _Set_Text (_um1 wird 1)<br />
-&gt; Bedingung (1 <strong>ist</strong> &gt; 0)</p>
<p>-&gt; goto do <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>........ die Bedingung wird niemals false sein.</p>
</blockquote>
<p>/* ************************************ */</p>
<p>WBool Form1::menu_1_Start_Click(<br />
WObject * source,<br />
WEventData * event )<br />
{</p>
<p>if (_text_nr == 1)<br />
_text_nr =0;<br />
_Set_Text();<br />
return FALSE;</p>
<p>}<br />
/* ********************************* */</p>
<p>LordJaxom schrieb:</p>
<blockquote>
<p>Die Endlosschleife:</p>
<pre><code class="language-cpp">do // ----&gt;ENDLOSSCHLEIFE :rage:  :rage:  :rage:  :rage: 
{
    if (_text_nr == 1)
_text_nr =0;

 else  
 _text_nr = 1;

_text_nr ++;
_Set_Text();
_Set_Text();

}

while (_um1 &gt; 0);
</code></pre>
<p>Schleife läuft also solange bis _um1 0 oder kleiner wird. Was passiert nun in _Set_Text()?</p>
<pre><code class="language-cpp">_um1=(_um1+1)%4;
</code></pre>
<p>So, zu was führt das nun, wenn _um1 beim Eintritt in die Schleife den Wert 1 hat? Richtig:</p>
<p>do<br />
-&gt; _Set_Text (_um1 wird 2)<br />
-&gt; _Set_Text (_um1 wird 3)<br />
-&gt; Bedingung (3 <strong>ist</strong> &gt; 0)</p>
<p>-&gt; _Set_Text (_um1 wird 0)<br />
-&gt; _Set_Text (_um1 wird 1)<br />
-&gt; Bedingung (1 <strong>ist</strong> &gt; 0)</p>
<p>-&gt; goto do <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>........ die Bedingung wird niemals false sein.</p>
</blockquote>
<p>Hallo ,<br />
ich habe meinen code kräftig überarbeitet und nun ist er &quot;schöner&quot;, oder???<br />
Nur noch 2 Variablen und alles ist weg, was nicht nötig war.<br />
Die wichtige Stelle ist mit /********************/ gekennzeichnet und hier ist sie nochmal:</p>
<p>// Declarations added here will be included at the top of the .HPP file</p>
<pre><code class="language-cpp">class __Form1_declspec Form1 : public __Form1_Base
{

    public:
        // add your public instance data here

    private:
         WBool _Set_Text(void); // add your private instance data here
         WInt _text_nr;
         WInt _um1;

    protected:
        // add your protected instance data here

};

// Code added here will be included at the top of the .CPP file
 WBool Form1::_Set_Text(void)
 {

    _um1=(_um1+1)%4;

  switch (_um1)
    {
     case 0:
           label_1-&gt;SetText( &quot;1 Text Position&quot; );
           label_2-&gt;SetText( &quot; &quot; );
           label_3-&gt;SetText( &quot; &quot; );
           label_4-&gt;SetText( &quot; &quot; );
       break;
       case 1:

            label_1-&gt;SetText( &quot;&quot; );
            label_2-&gt;SetText( &quot;2 Text Position &quot; );
            label_3-&gt;SetText( &quot;&quot; );
            label_4-&gt;SetText( &quot; &quot; );

       break;
      case 2:

           label_1-&gt;SetText( &quot;&quot; );
           label_2-&gt;SetText( &quot;&quot; );
           label_3-&gt;SetText( &quot;  3 Text Position &quot; );
           label_4-&gt;SetText( &quot;  &quot; );

      break;
       case 3:

            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot; &quot; );
            label_3-&gt;SetText( &quot; &quot; );
            label_4-&gt;SetText( &quot;4 Text Position &quot; );

      break; 

    }
  return FALSE;
   }

//  Include definitions for resources.
#include &quot;WRes.h&quot;

Form1::Form1()
{
 _text_nr = 0;

}

Form1::~Form1()
{

}

WBool Form1::menu_1_ErstePosition_Click(
    WObject *           source,
    WEventData *        event )
{
           label_1-&gt;SetText( &quot;1 Text Position &quot; );
           label_2-&gt;SetText( &quot; &quot; );
           label_3-&gt;SetText( &quot; &quot; );
           label_4-&gt;SetText( &quot; &quot; );
             if (_text_nr == 0 ) 
{ _um1 = 0;}
    return FALSE;
}

WBool Form1::menu_1_ZweitePosition_Click(
    WObject *           source,
    WEventData *        event )
{
            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot;2 Text Position &quot; );
            label_3-&gt;SetText( &quot; &quot; );
            label_4-&gt;SetText( &quot; &quot; );
        if (_text_nr == 0  ) 
{ _um1 = 1;}
    return FALSE;
}

WBool Form1::menu_1_DrittePosition_Click(
    WObject *           source,
    WEventData *        event )
{
            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot; &quot; );
            label_3-&gt;SetText( &quot; 3 Text Position&quot; );
            label_4-&gt;SetText( &quot; &quot; );
        if (_text_nr == 0 )  
{ _um1 = 2;}
    return FALSE;
}

WBool Form1::menu_1_ViertePosition_Click(
    WObject *           source,
    WEventData *        event )
{
            label_1-&gt;SetText( &quot; &quot; );
            label_2-&gt;SetText( &quot; &quot; );
            label_3-&gt;SetText( &quot; &quot; );
            label_4-&gt;SetText( &quot; 4 Text Position&quot; ); 
        if (_text_nr == 0 ) 
             {_um1 = 3; }
    return FALSE;
}
/* ************************************ */

WBool Form1::menu_1_Start_Click(
    WObject *           source,
    WEventData *        event )
{

if (_text_nr == 1)
    _text_nr =0;
    _Set_Text();
return FALSE;

}
/* *********************************  */

WBool Form1::cb_1_Click(
    WObject *           source,
    WEventData *        event )
{

 if (_text_nr == 1)
     _text_nr = 0;
     _Set_Text();

 return FALSE;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1047205</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1047205</guid><dc:creator><![CDATA[Renate]]></dc:creator><pubDate>Fri, 28 Apr 2006 16:59:17 GMT</pubDate></item></channel></rss>