<?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[while funktioniert nicht]]></title><description><![CDATA[<pre><code>//  3Potenzabteiler

#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;cmath&gt;
using namespace std;

int zahl;
int pot3;
int potenzgrenze=0;
int gugzz; //GesamtungeradeZahlZähler
int bugz;  //BereichsungeradeZahlZähler
int xox = 0;
int fzeh;
int pzz;
int teiler=3;
int found;

int main()
{
    for(zahl=1; zahl&lt;=1000000; zahl=zahl+2) //ungerader Zahlhersteller
    {
        if(zahl%5==0) //Fünfzähler
            {
                fzeh=fzeh+1;
            }
        else // Nur wenn Zahl nicht 5, dann Primprüfung
            {

               while ((teiler&lt;=sqrt(zahl)) %% (found == 0)) //Was soll hier die 2. Bedingung?
{
                   if ( zahl%teiler==0)
                        {
                            found=1; //Wieso macht er hier faund auf 1 und was ist found?
                        }
                   else
                        {
                       teiler++; //Teiler um 2 erhöhen damit er Ungerade bleibt.
                       teiler++;
                        }

                if (found==0) // Dann ist Zahl prim
                {
                     pzz++;// tue hier das, was zu tun ist, wenn der kandidat prim ist
                    cout&lt;&lt;pzz&lt;&lt;&quot; \n&quot;;
                }
} //Ende While

            }

        gugzz=gugzz+1;
        bugz=bugz+1;
        for (pot3=0; pot3&lt;=15; pot3++)
        {
            xox=potenzgrenze;
            potenzgrenze = pow(3.0,pot3);
            if (zahl == potenzgrenze)
            {
                cout&lt;&lt;&quot;Von &quot;&lt;&lt;xox&lt;&lt;&quot; bis einschl. &quot;&lt;&lt;zahl&lt;&lt;&quot;&quot;;
                //cout&lt;&lt;&quot; =3^&quot;&lt;&lt;pot3&lt;&lt;&quot; &quot;;
                cout&lt;&lt;&quot; gibt es &quot;&lt;&lt;bugz&lt;&lt;&quot; uZ davon sind &quot;&lt;&lt;fzeh&lt;&lt;&quot; 5en \n&quot;;
                //cout&lt;&lt;&quot;und insgesamt von 0 an &quot;&lt;&lt;gugzz&lt;&lt;&quot; \n&quot;;
                bugz=0;
                fzeh=0;
            }
        }
    }
    return 0;
}
</code></pre>
<p>Bis zur Implementierung der While-Schleife lief das Teil. Er zählte die ung. Zahlen bis zur Grenze, und die Fünfen. Jetzt wollt ich noch die Primzahlen zählen lassen.... und hab mir die While Schleife geborgt....</p>
<p>Nun sagt der Compiler: &quot;Expected Expression&quot; Was für einen Ausdruck erwartet er?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/316672/while-funktioniert-nicht</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Jul 2026 17:15:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/316672.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 12 May 2013 17:43:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to while funktioniert nicht on Sun, 12 May 2013 17:43:16 GMT]]></title><description><![CDATA[<pre><code>//  3Potenzabteiler

#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;cmath&gt;
using namespace std;

int zahl;
int pot3;
int potenzgrenze=0;
int gugzz; //GesamtungeradeZahlZähler
int bugz;  //BereichsungeradeZahlZähler
int xox = 0;
int fzeh;
int pzz;
int teiler=3;
int found;

int main()
{
    for(zahl=1; zahl&lt;=1000000; zahl=zahl+2) //ungerader Zahlhersteller
    {
        if(zahl%5==0) //Fünfzähler
            {
                fzeh=fzeh+1;
            }
        else // Nur wenn Zahl nicht 5, dann Primprüfung
            {

               while ((teiler&lt;=sqrt(zahl)) %% (found == 0)) //Was soll hier die 2. Bedingung?
{
                   if ( zahl%teiler==0)
                        {
                            found=1; //Wieso macht er hier faund auf 1 und was ist found?
                        }
                   else
                        {
                       teiler++; //Teiler um 2 erhöhen damit er Ungerade bleibt.
                       teiler++;
                        }

                if (found==0) // Dann ist Zahl prim
                {
                     pzz++;// tue hier das, was zu tun ist, wenn der kandidat prim ist
                    cout&lt;&lt;pzz&lt;&lt;&quot; \n&quot;;
                }
} //Ende While

            }

        gugzz=gugzz+1;
        bugz=bugz+1;
        for (pot3=0; pot3&lt;=15; pot3++)
        {
            xox=potenzgrenze;
            potenzgrenze = pow(3.0,pot3);
            if (zahl == potenzgrenze)
            {
                cout&lt;&lt;&quot;Von &quot;&lt;&lt;xox&lt;&lt;&quot; bis einschl. &quot;&lt;&lt;zahl&lt;&lt;&quot;&quot;;
                //cout&lt;&lt;&quot; =3^&quot;&lt;&lt;pot3&lt;&lt;&quot; &quot;;
                cout&lt;&lt;&quot; gibt es &quot;&lt;&lt;bugz&lt;&lt;&quot; uZ davon sind &quot;&lt;&lt;fzeh&lt;&lt;&quot; 5en \n&quot;;
                //cout&lt;&lt;&quot;und insgesamt von 0 an &quot;&lt;&lt;gugzz&lt;&lt;&quot; \n&quot;;
                bugz=0;
                fzeh=0;
            }
        }
    }
    return 0;
}
</code></pre>
<p>Bis zur Implementierung der While-Schleife lief das Teil. Er zählte die ung. Zahlen bis zur Grenze, und die Fünfen. Jetzt wollt ich noch die Primzahlen zählen lassen.... und hab mir die While Schleife geborgt....</p>
<p>Nun sagt der Compiler: &quot;Expected Expression&quot; Was für einen Ausdruck erwartet er?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2322838</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2322838</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Sun, 12 May 2013 17:43:16 GMT</pubDate></item><item><title><![CDATA[Reply to while funktioniert nicht on Sun, 12 May 2013 17:51:14 GMT]]></title><description><![CDATA[<pre><code>%%
</code></pre>
<p>Diesen Operator hat nicht mal Perl. Was soll der denn machen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2322842</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2322842</guid><dc:creator><![CDATA[sageru]]></dc:creator><pubDate>Sun, 12 May 2013 17:51:14 GMT</pubDate></item><item><title><![CDATA[Reply to while funktioniert nicht on Thu, 12 Jun 2014 01:34:08 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2322843</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2322843</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Thu, 12 Jun 2014 01:34:08 GMT</pubDate></item><item><title><![CDATA[Reply to while funktioniert nicht on Sun, 12 May 2013 17:55:19 GMT]]></title><description><![CDATA[<p>Swordfish schrieb:</p>
<blockquote>
<p>Was soll denn <code>%%</code> für ein Operator sein?</p>
</blockquote>
<p>Er hat den Code abgetippt und 5 statt 6 gedrückt, und seinen Post nicht durchgelesen, bevor er ihn abgeschickt hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2322845</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2322845</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Sun, 12 May 2013 17:55:19 GMT</pubDate></item><item><title><![CDATA[Reply to while funktioniert nicht on Sun, 12 May 2013 18:07:26 GMT]]></title><description><![CDATA[<p>Nein das ist aus C ein Operator, ein boolescher ....</p>
<p>oh, das mit der Verwechslung von 5 und 6 stimmt ....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2322849</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2322849</guid><dc:creator><![CDATA[brak]]></dc:creator><pubDate>Sun, 12 May 2013 18:07:26 GMT</pubDate></item><item><title><![CDATA[Reply to while funktioniert nicht on Mon, 13 May 2013 11:56:43 GMT]]></title><description><![CDATA[<p>Niemals Code abtippen! Benutze Copy&amp;Paste...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2322984</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2322984</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Mon, 13 May 2013 11:56:43 GMT</pubDate></item></channel></rss>