<?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[Fehler bei CPP Programmierung]]></title><description><![CDATA[<p>Hallo ich bastel ein Bußgeldkatalog für die Schule. Ich habe da ein Problem mit den If Funktionen. Nachdem ich die zugelassene Geschwindigkeit und die übertretende Geschwindigkeit eingegeben habe, errechnet er mir den c Wert. Der C Wert soll mit der If Funktion zu dem angegebenen Programmblock springen, der dann die entsprechende Strafe ausspuckt. Mein Problem ist, der zeigt mir andauernd alles an. Ich finde kein Rat mehr. Bitte helft mir.</p>
<p>Hier ist mein Aufbau:</p>
<p>{</p>
<p>int a;<br />
int b;<br />
int c;<br />
int y;<br />
int z;</p>
<p>cout &lt;&lt; &quot;Sie haben das Bussgeldkatalog geoeffnet, weil Sie sicherlich&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;zu schnell unterwegs waren.&quot; &quot;\n&quot;&quot;\n&quot;;<br />
cout &lt;&lt; &quot;Wenn Sie innerhalb geschlossener Ortschaften unterwegs waren,&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;druecken Sie die 1, fuer ausserhalb geschlossener Ortschaften die 2.&quot; &quot;\n&quot;;<br />
cin &gt;&gt; c;</p>
<p>if (c==1)<br />
{<br />
cout &lt;&lt; &quot;Innerortsberechnung&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;Bitte geben Sie die zugelassene Hoechstgeschwindigkeit an.&quot; &quot;\n&quot;;<br />
cin &gt;&gt; a;<br />
cout &lt;&lt; &quot;Bitte geben Sie nun Ihre Geschwindigkeit an.&quot; &quot;\n&quot;;<br />
cin &gt;&gt; b;<br />
c = (b - a);<br />
cout &lt;&lt; &quot;Ihre Geschwindigkeitsueberschreitung betrug:&quot; &quot;\n&quot;;<br />
cout &lt;&lt; c;</p>
<p>{<br />
if (c&gt;=0&lt;=10)<br />
{<br />
cout &lt;&lt; &quot;Bis 10 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;15 Euro Strafe.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=11&lt;=15)<br />
{<br />
cout &lt;&lt; &quot;Bis 15 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;25 Euro Strafe.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=16&lt;=20)<br />
{<br />
cout &lt;&lt; &quot;Bis 20 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;35 Euro Strafe.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=21&lt;=25)<br />
{<br />
cout &lt;&lt; &quot;Bis 25 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;80 Euro Strafe + 23,50 Euro Gebühren + 1 Punkt in Flensburg.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=26&lt;=30)<br />
{<br />
cout &lt;&lt; &quot;Bis 30 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;100 Euro Strafe + 23,50 Euro Gebühren + 3 Punkte in Flensburg.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=31&lt;=40)<br />
{<br />
cout &lt;&lt; &quot;Bis 30 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;160 Euro Strafe + 23,50 Euro Gebühren + 3 Punkte in Flensburg + 1 Monat Fahrverbot.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=41&lt;=50)<br />
{<br />
cout &lt;&lt; &quot;Bis 30 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;200 Euro Strafe + 23,50 Euro Gebühren + 4 Punkte in Flensburg + 1 Monat Fahrverbot.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=51&lt;=60)<br />
{<br />
cout &lt;&lt; &quot;Bis 30 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;280 Euro Strafe + 23,50 Euro Gebühren + 4 Punkte in Flensburg + 2 Monate Fahrverbot.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=61&lt;=70)<br />
{<br />
cout &lt;&lt; &quot;Bis 30 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;480 Euro Strafe + 23,50 Euro Gebühren + 4 Punkte in Flensburg + 3 Monate Fahrverbot.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=71)<br />
{<br />
cout &lt;&lt; &quot;Bis 30 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;680 Euro Strafe + 23,50 Euro Gebühren + 4 Punkte in Flensburg + 3 Monate Fahrverbot.&quot;;<br />
}<br />
}<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/282225/fehler-bei-cpp-programmierung</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 08:06:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/282225.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 16 Feb 2011 11:33:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fehler bei CPP Programmierung on Wed, 16 Feb 2011 11:33:22 GMT]]></title><description><![CDATA[<p>Hallo ich bastel ein Bußgeldkatalog für die Schule. Ich habe da ein Problem mit den If Funktionen. Nachdem ich die zugelassene Geschwindigkeit und die übertretende Geschwindigkeit eingegeben habe, errechnet er mir den c Wert. Der C Wert soll mit der If Funktion zu dem angegebenen Programmblock springen, der dann die entsprechende Strafe ausspuckt. Mein Problem ist, der zeigt mir andauernd alles an. Ich finde kein Rat mehr. Bitte helft mir.</p>
<p>Hier ist mein Aufbau:</p>
<p>{</p>
<p>int a;<br />
int b;<br />
int c;<br />
int y;<br />
int z;</p>
<p>cout &lt;&lt; &quot;Sie haben das Bussgeldkatalog geoeffnet, weil Sie sicherlich&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;zu schnell unterwegs waren.&quot; &quot;\n&quot;&quot;\n&quot;;<br />
cout &lt;&lt; &quot;Wenn Sie innerhalb geschlossener Ortschaften unterwegs waren,&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;druecken Sie die 1, fuer ausserhalb geschlossener Ortschaften die 2.&quot; &quot;\n&quot;;<br />
cin &gt;&gt; c;</p>
<p>if (c==1)<br />
{<br />
cout &lt;&lt; &quot;Innerortsberechnung&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;Bitte geben Sie die zugelassene Hoechstgeschwindigkeit an.&quot; &quot;\n&quot;;<br />
cin &gt;&gt; a;<br />
cout &lt;&lt; &quot;Bitte geben Sie nun Ihre Geschwindigkeit an.&quot; &quot;\n&quot;;<br />
cin &gt;&gt; b;<br />
c = (b - a);<br />
cout &lt;&lt; &quot;Ihre Geschwindigkeitsueberschreitung betrug:&quot; &quot;\n&quot;;<br />
cout &lt;&lt; c;</p>
<p>{<br />
if (c&gt;=0&lt;=10)<br />
{<br />
cout &lt;&lt; &quot;Bis 10 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;15 Euro Strafe.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=11&lt;=15)<br />
{<br />
cout &lt;&lt; &quot;Bis 15 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;25 Euro Strafe.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=16&lt;=20)<br />
{<br />
cout &lt;&lt; &quot;Bis 20 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;35 Euro Strafe.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=21&lt;=25)<br />
{<br />
cout &lt;&lt; &quot;Bis 25 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;80 Euro Strafe + 23,50 Euro Gebühren + 1 Punkt in Flensburg.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=26&lt;=30)<br />
{<br />
cout &lt;&lt; &quot;Bis 30 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;100 Euro Strafe + 23,50 Euro Gebühren + 3 Punkte in Flensburg.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=31&lt;=40)<br />
{<br />
cout &lt;&lt; &quot;Bis 30 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;160 Euro Strafe + 23,50 Euro Gebühren + 3 Punkte in Flensburg + 1 Monat Fahrverbot.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=41&lt;=50)<br />
{<br />
cout &lt;&lt; &quot;Bis 30 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;200 Euro Strafe + 23,50 Euro Gebühren + 4 Punkte in Flensburg + 1 Monat Fahrverbot.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=51&lt;=60)<br />
{<br />
cout &lt;&lt; &quot;Bis 30 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;280 Euro Strafe + 23,50 Euro Gebühren + 4 Punkte in Flensburg + 2 Monate Fahrverbot.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=61&lt;=70)<br />
{<br />
cout &lt;&lt; &quot;Bis 30 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;480 Euro Strafe + 23,50 Euro Gebühren + 4 Punkte in Flensburg + 3 Monate Fahrverbot.&quot;;<br />
}<br />
}</p>
<p>{<br />
if (c&gt;=71)<br />
{<br />
cout &lt;&lt; &quot;Bis 30 km/h zu schnell erwartet Sie:&quot; &quot;\n&quot; &quot;\n&quot;;<br />
cout &lt;&lt; &quot;680 Euro Strafe + 23,50 Euro Gebühren + 4 Punkte in Flensburg + 3 Monate Fahrverbot.&quot;;<br />
}<br />
}<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2021731</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2021731</guid><dc:creator><![CDATA[Styff Meister]]></dc:creator><pubDate>Wed, 16 Feb 2011 11:33:22 GMT</pubDate></item><item><title><![CDATA[Reply to Fehler bei CPP Programmierung on Wed, 16 Feb 2011 11:37:59 GMT]]></title><description><![CDATA[<p>if (c&gt;=0&lt;=10)</p>
<p>O_o</p>
<p>Was willst du mit dieser abfrage erreichen ?</p>
<p>if (c&gt;=0 &amp;&amp; c&lt;=10)</p>
<p>alle anderen genau so.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2021734</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2021734</guid><dc:creator><![CDATA[trolLOL]]></dc:creator><pubDate>Wed, 16 Feb 2011 11:37:59 GMT</pubDate></item><item><title><![CDATA[Reply to Fehler bei CPP Programmierung on Wed, 16 Feb 2011 11:42:21 GMT]]></title><description><![CDATA[<p>Hat sich erledigt . Selbst behoben <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2021736</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2021736</guid><dc:creator><![CDATA[Styff Meister]]></dc:creator><pubDate>Wed, 16 Feb 2011 11:42:21 GMT</pubDate></item><item><title><![CDATA[Reply to Fehler bei CPP Programmierung on Wed, 16 Feb 2011 14:30:17 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/u1819" rel="nofollow">rüdiger</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/f8" rel="nofollow">Rund um die Programmierung</a> in das Forum <a href="http://www.c-plusplus.net/forum/f15" rel="nofollow">C++ (auch C++0x)</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2021831</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2021831</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Wed, 16 Feb 2011 14:30:17 GMT</pubDate></item><item><title><![CDATA[Reply to Fehler bei CPP Programmierung on Wed, 16 Feb 2011 15:02:39 GMT]]></title><description><![CDATA[<p>Grauenhaft - beim Ansehen der ersten Zeilen hab ich schon aufgehört weiterzulesen.<br />
statt</p>
<pre><code class="language-cpp">int a;
int b;
int c;
int y;
int z;
</code></pre>
<p>solltest - nein, <strong>musst</strong> - Du deinen Variablen sinnvolle Namen geben!<br />
Also:</p>
<pre><code class="language-cpp">bool aussenOrt; //da hier nur 2 Möglichkeiten bestehen, reicht bool aus
int hoechstGeschwindigkeit, Geschwindigkeit, ueberschreitung;
</code></pre>
<p>Und benutze bitte die cpp-Tags beim posten von Code.</p>
<p>Ist zwar ein gewisser Mehraufwand dabei, aber wenn du ein paar Tage später mal wieder reinschaust, dann wirst du denken &quot;wtf! Was ist denn a? Wo benutze ich b? Und wieso lasse ich erst in c eingeben ob ausserhalb eines Ortes und benutze es dann um die Überschreitung zu errechnen?? HÄ?!&quot;, naja oder so ähnlich.<br />
ALso gleich richtige Bezeichner nehmen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2021854</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2021854</guid><dc:creator><![CDATA[Incocnito]]></dc:creator><pubDate>Wed, 16 Feb 2011 15:02:39 GMT</pubDate></item><item><title><![CDATA[Reply to Fehler bei CPP Programmierung on Wed, 16 Feb 2011 16:17:28 GMT]]></title><description><![CDATA[<p>Incocnito schrieb:</p>
<blockquote>
<pre><code class="language-cpp">bool aussenOrt; //da hier nur 2 Möglichkeiten bestehen, reicht bool aus
int hoechstGeschwindigkeit, Geschwindigkeit, ueberschreitung;
</code></pre>
</blockquote>
<p>Und wenn wir schon dabei sind: Du solltest deinen Variablen auch den richtigen Typ geben. Ich nehme einfach mal an, dass Höchstgeschwindigkeit, Geschwindigkeit und Überschreitung größer als 0 sind, daher ist der richtige Datentyp <strong>unsigned</strong> int. Anders sieht´s natürlich aus, wenn statt <code>Ueberschreitung Differenz</code> benutzt wird, die kann ja tatsächlich negativ werden. Ich geh auch davon aus, dass das Auto vorwärts geblitzt wurde, ich glaube, der Bußgeldkatalog sieht andere Strafen vor, wenn man mit 80km/h beim Rückwärtsfahren erwischt wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2021909</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2021909</guid><dc:creator><![CDATA[DocShoe]]></dc:creator><pubDate>Wed, 16 Feb 2011 16:17:28 GMT</pubDate></item><item><title><![CDATA[Reply to Fehler bei CPP Programmierung on Wed, 16 Feb 2011 16:31:56 GMT]]></title><description><![CDATA[<p>DocShoe schrieb:</p>
<blockquote>
<p>Ich geh auch davon aus, dass das Auto vorwärts geblitzt wurde, ich glaube, der Bußgeldkatalog sieht andere Strafen vor, wenn man mit 80km/h beim Rückwärtsfahren erwischt wird.</p>
</blockquote>
<p>off topic<br />
Die StVO interessiert die Richtung als solche nicht.<br />
Wenn man rückwärts fährt ist man tatsächlich in der Gegenrichtung unterwegs, also ist wäre vermutl. die Geschwindigkeitsbegrenzung, die für die andere Richtung gilt (kann ja manchmal abweichen) zu beachten. Andererseits düfte in den Fällen, bei denen das relevant sein könnte, sowieso zu bezweifeln sein, dass das Fahrzeug noch beherrscht wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2021915</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2021915</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 16 Feb 2011 16:31:56 GMT</pubDate></item></channel></rss>