<?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[Bedingung falsch]]></title><description><![CDATA[<p>Im Teil &quot;Pausenergaenzung&quot; sollen die Takte so aufgefüllt werde, dass sie korrekt sind (Viervierteltakt). So stimmt es auch, aber ich weiß nicht, wie ich die Bedingung setzen muss, dass er aus der zweiten for-Schleife springt.<br />
Hat jemand 'ne Idee?</p>
<p>mfG<br />
Phisherman</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;conio.h&gt;
#include &lt;cstdlib&gt;
#include &lt;ctime&gt;
#include &lt;windows.h&gt;
using namespace std;

int main()
{
    char Eingabe[1000]=&quot;0&quot;, Eingabe_fixed[1000]=&quot;0&quot;;
    int bpm, checksum, checkvar=0, checkindex=0;
    int frequenz=500;
    cout&lt;&lt;&quot;Befehle:\n\n\n&quot;;
    cout&lt;&lt;&quot;Ganze Note\t1\n&quot;;
    cout&lt;&lt;&quot;Halbe Note\t2\n&quot;;
    cout&lt;&lt;&quot;Viertel Note\t4\n&quot;;
    cout&lt;&lt;&quot;Achtel Note\t8\n&quot;;
    cout&lt;&lt;&quot;Ganze Pause\tp\n&quot;;
    cout&lt;&lt;&quot;Halbe Pause\th\n&quot;;
    cout&lt;&lt;&quot;Viertel Pause\tv\n&quot;;
    cout&lt;&lt;&quot;Achtel Pause\ta\n&quot;;
    cout&lt;&lt;&quot;Metronom\tm\n\n\n\n&quot;;
    cout&lt;&lt;&quot;Rhythmus eingeben: &quot;;
    cin.getline (Eingabe, sizeof(Eingabe));

    cout&lt;&lt;&quot;Schl&quot;&lt;&lt;char(132)&lt;&lt;&quot;ge pro Minute: &quot;;
    cin&gt;&gt;bpm;

//**Pausenergaenzung************************************************************
    for (checkvar; Eingabe[checkvar]!='\0' &amp;&amp; Eingabe[checkvar]!='0'; ++checkvar)
    {
        checksum=0;
        for (int j=checkvar; Eingabe[j]!=' ' || Eingabe[j]!='\0' || Eingabe[j]!='0'; ++j)
        {
             switch(Eingabe[j])
            {
                case '1': //ganze Note
                     {
                         checksum+=8;
                         Eingabe_fixed[checkindex]='1';
                         break;
                     }
                case '2': //halbe Note
                     {
                         checksum+=4;
                         Eingabe_fixed[checkindex]='2';
                         break;
                     }
                case '4': //Viertelnote
                     {
                         checksum+=2;
                         Eingabe_fixed[checkindex]='4';
                         break;
                     }
                case '8': //Achtelnote
                     {
                         checksum+=1;
                         Eingabe_fixed[checkindex]='8';
                         break;
                     }
                case 'g': //ganze Pause
                     {
                         checksum+=8;
                         Eingabe_fixed[checkindex]='g';
                         break;
                     }
                case 'h': //halbe Pause
                     {
                         checksum+=4;
                         Eingabe_fixed[checkindex]='h';
                         break;
                     }
                case 'v': //Viertelpause
                     {
                         checksum+=2;
                         Eingabe_fixed[checkindex]='v';
                         break;
                     }
                case 'a': //Achtel Pause
                     {
                         checksum+=1;
                         Eingabe_fixed[checkindex]='a';
                         break;
                     }
            }
            ++checkindex;
            if (Eingabe[j+1]==' ' || Eingabe[j+1]=='\0' || Eingabe[j+1]=='0') //Pruefen, ob Takt endet
            {
                 if (checksum!=8)
                 {
                     while (checksum&gt;8)
                         checksum-=8;
                     switch (checksum)
                     {
                            case 0:
                                 {
                                     Eingabe_fixed[checkindex]='h';
                                     Eingabe_fixed[checkindex+1]='h';
                                     checkindex+=2;
                                     break;
                                 }
                            case 1:
                                 {
                                     Eingabe_fixed[checkindex]='h';
                                     Eingabe_fixed[checkindex+1]='v';
                                     Eingabe_fixed[checkindex+2]='a';
                                     checkindex+=3;
                                     break;
                                 }
                            case 2:
                                 {
                                     Eingabe_fixed[checkindex]='h';
                                     Eingabe_fixed[checkindex+1]='v';
                                     checkindex+=2;
                                     break;
                                 }
                            case 3:
                                 {
                                     Eingabe_fixed[checkindex]='h';
                                     Eingabe_fixed[checkindex+1]='v';
                                     checkindex+=2;
                                     break;
                                 }
                            case 4:
                                 {
                                     Eingabe_fixed[checkindex]='h';
                                     checkindex+=1;
                                     break;
                                 }
                            case 5:
                                 {
                                     Eingabe_fixed[checkindex]='v';
                                     Eingabe_fixed[checkindex+1]='a';
                                     checkindex+=2;
                                     break;
                                 }
                            case 6:
                                 {
                                     Eingabe_fixed[checkindex]='v';
                                     checkindex+=1;
                                     break;
                                 }
                            case 7:
                                 {
                                     Eingabe_fixed[checkindex]='a';
                                     checkindex+=1;
                                     break;
                                 }
                     }
                 }
                 checkvar=j+1;
            }
        }
    }
//**Ende Pausenergaenzung*******************************************************

    for (int i=0; Eingabe_fixed[i]!='\0'; ++i)
    {
        switch(Eingabe[i])
        {
            case '1': //ganze Note
                 {
                     cout&lt;&lt;&quot;X.......&quot;;
                     Beep(frequenz, 240000/bpm);
                     break;
                 }
            case '2': //halbe Note
                 {
                     cout&lt;&lt;&quot;X...&quot;;
                     Beep(frequenz, 120000/bpm);
                     break;
                 }
            case '4': //Viertelnote
                 {
                     cout&lt;&lt;&quot;X.&quot;;
                     Beep(frequenz, 60000/bpm);
                     break;
                 }
            case '8': //Achtelnote
                 {
                     cout&lt;&lt;&quot;X&quot;;
                     Beep(frequenz, 30000/bpm);
                     break;
                 }
            case 'g': //ganze Pause
                 {
                     cout&lt;&lt;&quot;g&quot;;
                     Sleep(240000/bpm);
                     break;
                 }
            case 'h': //halbe Pause
                 {
                     cout&lt;&lt;&quot;v&quot;;
                     Sleep(120000/bpm);
                     break;
                 }
            case 'v': //Viertelpause
                 {
                     cout&lt;&lt;&quot;v&quot;;
                     Sleep(60000/bpm);
                     break;
                 }
            case 'a': //Achtel Pause
                 {
                     cout&lt;&lt;&quot;a&quot;;
                     Sleep(30000/bpm);
                     break;
                 }
            case 'm': // metronom
                 {
                     cout&lt;&lt;&quot;Metronom...&quot;;
                     while (1)
                         {
                              Beep(frequenz+500,60000/bpm);
                              Beep(frequenz,60000/bpm);
                              Beep(frequenz,60000/bpm);
                              Beep(frequenz,60000/bpm);
                         }
                 }
        }
    }

    getch();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/262476/bedingung-falsch</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 16:13:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/262476.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 06 Mar 2010 20:57:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bedingung falsch on Sat, 06 Mar 2010 20:57:31 GMT]]></title><description><![CDATA[<p>Im Teil &quot;Pausenergaenzung&quot; sollen die Takte so aufgefüllt werde, dass sie korrekt sind (Viervierteltakt). So stimmt es auch, aber ich weiß nicht, wie ich die Bedingung setzen muss, dass er aus der zweiten for-Schleife springt.<br />
Hat jemand 'ne Idee?</p>
<p>mfG<br />
Phisherman</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;conio.h&gt;
#include &lt;cstdlib&gt;
#include &lt;ctime&gt;
#include &lt;windows.h&gt;
using namespace std;

int main()
{
    char Eingabe[1000]=&quot;0&quot;, Eingabe_fixed[1000]=&quot;0&quot;;
    int bpm, checksum, checkvar=0, checkindex=0;
    int frequenz=500;
    cout&lt;&lt;&quot;Befehle:\n\n\n&quot;;
    cout&lt;&lt;&quot;Ganze Note\t1\n&quot;;
    cout&lt;&lt;&quot;Halbe Note\t2\n&quot;;
    cout&lt;&lt;&quot;Viertel Note\t4\n&quot;;
    cout&lt;&lt;&quot;Achtel Note\t8\n&quot;;
    cout&lt;&lt;&quot;Ganze Pause\tp\n&quot;;
    cout&lt;&lt;&quot;Halbe Pause\th\n&quot;;
    cout&lt;&lt;&quot;Viertel Pause\tv\n&quot;;
    cout&lt;&lt;&quot;Achtel Pause\ta\n&quot;;
    cout&lt;&lt;&quot;Metronom\tm\n\n\n\n&quot;;
    cout&lt;&lt;&quot;Rhythmus eingeben: &quot;;
    cin.getline (Eingabe, sizeof(Eingabe));

    cout&lt;&lt;&quot;Schl&quot;&lt;&lt;char(132)&lt;&lt;&quot;ge pro Minute: &quot;;
    cin&gt;&gt;bpm;

//**Pausenergaenzung************************************************************
    for (checkvar; Eingabe[checkvar]!='\0' &amp;&amp; Eingabe[checkvar]!='0'; ++checkvar)
    {
        checksum=0;
        for (int j=checkvar; Eingabe[j]!=' ' || Eingabe[j]!='\0' || Eingabe[j]!='0'; ++j)
        {
             switch(Eingabe[j])
            {
                case '1': //ganze Note
                     {
                         checksum+=8;
                         Eingabe_fixed[checkindex]='1';
                         break;
                     }
                case '2': //halbe Note
                     {
                         checksum+=4;
                         Eingabe_fixed[checkindex]='2';
                         break;
                     }
                case '4': //Viertelnote
                     {
                         checksum+=2;
                         Eingabe_fixed[checkindex]='4';
                         break;
                     }
                case '8': //Achtelnote
                     {
                         checksum+=1;
                         Eingabe_fixed[checkindex]='8';
                         break;
                     }
                case 'g': //ganze Pause
                     {
                         checksum+=8;
                         Eingabe_fixed[checkindex]='g';
                         break;
                     }
                case 'h': //halbe Pause
                     {
                         checksum+=4;
                         Eingabe_fixed[checkindex]='h';
                         break;
                     }
                case 'v': //Viertelpause
                     {
                         checksum+=2;
                         Eingabe_fixed[checkindex]='v';
                         break;
                     }
                case 'a': //Achtel Pause
                     {
                         checksum+=1;
                         Eingabe_fixed[checkindex]='a';
                         break;
                     }
            }
            ++checkindex;
            if (Eingabe[j+1]==' ' || Eingabe[j+1]=='\0' || Eingabe[j+1]=='0') //Pruefen, ob Takt endet
            {
                 if (checksum!=8)
                 {
                     while (checksum&gt;8)
                         checksum-=8;
                     switch (checksum)
                     {
                            case 0:
                                 {
                                     Eingabe_fixed[checkindex]='h';
                                     Eingabe_fixed[checkindex+1]='h';
                                     checkindex+=2;
                                     break;
                                 }
                            case 1:
                                 {
                                     Eingabe_fixed[checkindex]='h';
                                     Eingabe_fixed[checkindex+1]='v';
                                     Eingabe_fixed[checkindex+2]='a';
                                     checkindex+=3;
                                     break;
                                 }
                            case 2:
                                 {
                                     Eingabe_fixed[checkindex]='h';
                                     Eingabe_fixed[checkindex+1]='v';
                                     checkindex+=2;
                                     break;
                                 }
                            case 3:
                                 {
                                     Eingabe_fixed[checkindex]='h';
                                     Eingabe_fixed[checkindex+1]='v';
                                     checkindex+=2;
                                     break;
                                 }
                            case 4:
                                 {
                                     Eingabe_fixed[checkindex]='h';
                                     checkindex+=1;
                                     break;
                                 }
                            case 5:
                                 {
                                     Eingabe_fixed[checkindex]='v';
                                     Eingabe_fixed[checkindex+1]='a';
                                     checkindex+=2;
                                     break;
                                 }
                            case 6:
                                 {
                                     Eingabe_fixed[checkindex]='v';
                                     checkindex+=1;
                                     break;
                                 }
                            case 7:
                                 {
                                     Eingabe_fixed[checkindex]='a';
                                     checkindex+=1;
                                     break;
                                 }
                     }
                 }
                 checkvar=j+1;
            }
        }
    }
//**Ende Pausenergaenzung*******************************************************

    for (int i=0; Eingabe_fixed[i]!='\0'; ++i)
    {
        switch(Eingabe[i])
        {
            case '1': //ganze Note
                 {
                     cout&lt;&lt;&quot;X.......&quot;;
                     Beep(frequenz, 240000/bpm);
                     break;
                 }
            case '2': //halbe Note
                 {
                     cout&lt;&lt;&quot;X...&quot;;
                     Beep(frequenz, 120000/bpm);
                     break;
                 }
            case '4': //Viertelnote
                 {
                     cout&lt;&lt;&quot;X.&quot;;
                     Beep(frequenz, 60000/bpm);
                     break;
                 }
            case '8': //Achtelnote
                 {
                     cout&lt;&lt;&quot;X&quot;;
                     Beep(frequenz, 30000/bpm);
                     break;
                 }
            case 'g': //ganze Pause
                 {
                     cout&lt;&lt;&quot;g&quot;;
                     Sleep(240000/bpm);
                     break;
                 }
            case 'h': //halbe Pause
                 {
                     cout&lt;&lt;&quot;v&quot;;
                     Sleep(120000/bpm);
                     break;
                 }
            case 'v': //Viertelpause
                 {
                     cout&lt;&lt;&quot;v&quot;;
                     Sleep(60000/bpm);
                     break;
                 }
            case 'a': //Achtel Pause
                 {
                     cout&lt;&lt;&quot;a&quot;;
                     Sleep(30000/bpm);
                     break;
                 }
            case 'm': // metronom
                 {
                     cout&lt;&lt;&quot;Metronom...&quot;;
                     while (1)
                         {
                              Beep(frequenz+500,60000/bpm);
                              Beep(frequenz,60000/bpm);
                              Beep(frequenz,60000/bpm);
                              Beep(frequenz,60000/bpm);
                         }
                 }
        }
    }

    getch();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1865257</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1865257</guid><dc:creator><![CDATA[Phisherman]]></dc:creator><pubDate>Sat, 06 Mar 2010 20:57:31 GMT</pubDate></item><item><title><![CDATA[Reply to Bedingung falsch on Sun, 07 Mar 2010 13:05:21 GMT]]></title><description><![CDATA[<p>Keine Ahung, was du genau meinst, aber du kannst ja mal Funktionen benutzen, um das ganze ein wenig logisch zu gliedern und bei Funktionen kannst du ganz bequem mit return rausspringen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1865443</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1865443</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sun, 07 Mar 2010 13:05:21 GMT</pubDate></item><item><title><![CDATA[Reply to Bedingung falsch on Mon, 08 Mar 2010 11:43:03 GMT]]></title><description><![CDATA[<p>Die Bedingung verwendet den falschen Operator:</p>
<pre><code class="language-cpp">Eingabe[j]!=' ' &amp;&amp; Eingabe[j]!='\0' &amp;&amp; Eingabe[j]!='0'
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1865831</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1865831</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Mon, 08 Mar 2010 11:43:03 GMT</pubDate></item></channel></rss>