<?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[Operatoren gesucht (in do while Schleife)]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>am Ende des Programmes sind 3 Zeilen mit /*1/ /*2/ /*3/ markiert. Ich möchte nun Zeile /*1/ löschen. Wie muss ich *2 und *3 verändern damit die while Schleife für j und J sowie für n und N gilt? Ich finde vermutlich die richtigen Operatoren nicht..</p>
<p>Danke!</p>
<pre><code>#include &lt;stdio.h&gt;
#include &lt;ctype.h&gt;

#define INKL_KM 60.0
#define KM_PREIS 0.40
#define TAG_PREIS 60.0

int main(void)
{char weiter;
double km, tage, preis, zus_km;
do
{
	printf(&quot;Tage:&quot;); scanf (&quot;%lf&quot;, &amp;tage);
	printf(&quot;Kilometer:&quot;); scanf(&quot;%lf&quot;, &amp;km);

	zus_km = km - tage * INKL_KM;
	if(zus_km &lt;0) zus_km =0;

	preis = tage * TAG_PREIS + zus_km * KM_PREIS;
	printf(&quot;Preis: %.2f EUR \n&quot;, preis);
	do
	{
		printf(&quot;Nochmal (j/n) bzw. (J/N): &quot;);
		scanf (&quot; %c&quot;, &amp;weiter);
		weiter = tolower(weiter); /*1*/
	}
	while(weiter !=	'j' &amp;&amp; weiter != 'n'); /*2*/
}
while (weiter == 'j'); /*3*/
return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/313525/operatoren-gesucht-in-do-while-schleife</link><generator>RSS for Node</generator><lastBuildDate>Sun, 02 Aug 2026 03:55:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/313525.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 03 Feb 2013 10:28:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Sun, 03 Feb 2013 10:28:32 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>am Ende des Programmes sind 3 Zeilen mit /*1/ /*2/ /*3/ markiert. Ich möchte nun Zeile /*1/ löschen. Wie muss ich *2 und *3 verändern damit die while Schleife für j und J sowie für n und N gilt? Ich finde vermutlich die richtigen Operatoren nicht..</p>
<p>Danke!</p>
<pre><code>#include &lt;stdio.h&gt;
#include &lt;ctype.h&gt;

#define INKL_KM 60.0
#define KM_PREIS 0.40
#define TAG_PREIS 60.0

int main(void)
{char weiter;
double km, tage, preis, zus_km;
do
{
	printf(&quot;Tage:&quot;); scanf (&quot;%lf&quot;, &amp;tage);
	printf(&quot;Kilometer:&quot;); scanf(&quot;%lf&quot;, &amp;km);

	zus_km = km - tage * INKL_KM;
	if(zus_km &lt;0) zus_km =0;

	preis = tage * TAG_PREIS + zus_km * KM_PREIS;
	printf(&quot;Preis: %.2f EUR \n&quot;, preis);
	do
	{
		printf(&quot;Nochmal (j/n) bzw. (J/N): &quot;);
		scanf (&quot; %c&quot;, &amp;weiter);
		weiter = tolower(weiter); /*1*/
	}
	while(weiter !=	'j' &amp;&amp; weiter != 'n'); /*2*/
}
while (weiter == 'j'); /*3*/
return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2295728</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295728</guid><dc:creator><![CDATA[felixhase]]></dc:creator><pubDate>Sun, 03 Feb 2013 10:28:32 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Sun, 03 Feb 2013 10:32:41 GMT]]></title><description><![CDATA[<pre><code>weiter !='j' &amp;&amp; weiter != 'n' &amp;&amp; weiter!='J&amp;&amp; weiter !='N'
</code></pre>
<p>Aber best Du sicher, daß das C++ ist? Mir scheint, der Code passt besser ins C-Forum.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2295729</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295729</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Sun, 03 Feb 2013 10:32:41 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Sun, 03 Feb 2013 10:47:18 GMT]]></title><description><![CDATA[<p>Dachte eigentlich, dass der Code schon C++ ist. Zumindest in Visual C++ geschrieben.</p>
<p>Deine Lösung hatte ich schon versucht. Aber es funktioniert so leider nicht ganz. Hast du dir Zeile 3 so vorgestellt?</p>
<pre><code>#include &lt;stdio.h&gt;
#include &lt;ctype.h&gt;

#define INKL_KM 60.0
#define KM_PREIS 0.40
#define TAG_PREIS 60.0

int main(void)
{char weiter;
double km, tage, preis, zus_km;
do
{
	printf(&quot;Tage:&quot;); scanf (&quot;%lf&quot;, &amp;tage);
	printf(&quot;Kilometer:&quot;); scanf(&quot;%lf&quot;, &amp;km);

	zus_km = km - tage * INKL_KM;
	if(zus_km &lt;0) zus_km =0;

	preis = tage * TAG_PREIS + zus_km * KM_PREIS;
	printf(&quot;Preis: %.2f EUR \n&quot;, preis);
	do
	{
		printf(&quot;Nochmal (j/n) bzw. (J/N): &quot;);
		scanf (&quot; %c&quot;, &amp;weiter);

	}
	while (weiter !='j' &amp;&amp; weiter != 'n' &amp;&amp; weiter!='J' &amp;&amp; weiter !='N'); /*2*/
}
while (weiter == 'j' &amp;&amp; weiter == 'J'); /*3*/
return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2295730</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295730</guid><dc:creator><![CDATA[felixhase]]></dc:creator><pubDate>Sun, 03 Feb 2013 10:47:18 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Sun, 03 Feb 2013 10:53:03 GMT]]></title><description><![CDATA[<p>aber vermutlich hast du Recht, Visual C++ macht das Programm noch nicht zu C++</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2295731</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295731</guid><dc:creator><![CDATA[felixhase]]></dc:creator><pubDate>Sun, 03 Feb 2013 10:53:03 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Thu, 12 Jun 2014 11:03:15 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2295738</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295738</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Thu, 12 Jun 2014 11:03:15 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Sun, 03 Feb 2013 11:16:54 GMT]]></title><description><![CDATA[<pre><code>while (weiter == 'j' ^ weiter == 'J'); /*3*/
</code></pre>
<p>Hab es mal mit &quot;Oder&quot; versucht..<br />
Danke! <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/2295742</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295742</guid><dc:creator><![CDATA[felixhase]]></dc:creator><pubDate>Sun, 03 Feb 2013 11:16:54 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Sun, 03 Feb 2013 11:19:32 GMT]]></title><description><![CDATA[<p>Das ist aber kein Oder, das ist ein XOR...</p>
<p>Edit: Macht aber in diesem Fall das Gleiche.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2295743</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295743</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sun, 03 Feb 2013 11:19:32 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Sun, 03 Feb 2013 11:26:28 GMT]]></title><description><![CDATA[<p>Also korrekt dann so?</p>
<pre><code>while (weiter == 'j' || weiter == 'J'); /*3*/
</code></pre>
<p>was macht das XOR? Ich kenn sonst nur NOR NAND etc. also negiert..</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2295745</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295745</guid><dc:creator><![CDATA[felixhase]]></dc:creator><pubDate>Sun, 03 Feb 2013 11:26:28 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Sun, 03 Feb 2013 12:05:37 GMT]]></title><description><![CDATA[<p>XOR = Exclusive OR = ausschliessendes Oder (&quot;Entweder Oder&quot;)</p>
<p>Im Falle von <code>bool</code> ist das Resultat einer XOR-Verknüpfung genau dann <code>true</code> , wenn einer der beiden Operanden <code>true</code> ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2295753</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295753</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sun, 03 Feb 2013 12:05:37 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Thu, 12 Jun 2014 11:03:19 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2295754</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295754</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Thu, 12 Jun 2014 11:03:19 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Sun, 03 Feb 2013 12:06:24 GMT]]></title><description><![CDATA[<p>sauber..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2295757</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295757</guid><dc:creator><![CDATA[felixhase]]></dc:creator><pubDate>Sun, 03 Feb 2013 12:06:24 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Mon, 04 Feb 2013 09:38:19 GMT]]></title><description><![CDATA[<p>felixhase schrieb:</p>
<blockquote>
<p>sauber..</p>
</blockquote>
<p>Nicht wirklich. Ich persönlich empfinde die Benutzung des Komma-Operators in den Schleifenköpfen eher als Missbrauch, andere mögen es vielleicht als &quot;coolen Trick&quot; ansehen. Leicht lesbar (weil bekannt) ist es jedenfalls nicht. Alles in eine Funktion zu stopfen halte ich auch für nicht so prickelnd. Die ständige Wiederholung (cerr, cin.ignore, cin.clear) ist aber auf keinen Fall sauber. Die Definition von Variablen wie ch Ewigkeiten bevor sie tatsächlich gebraucht werden ist im letzten Jahrtausend in C nötig gewesen, in C++ aber nie.</p>
<p>Davon mal abgesehen ist das Programm schlichtweg verbuggt. Es ist eine Fehlerbehandlung eingebaut, die keine Fehler behandelt:</p>
<p><a href="http://ideone.com/3lx0Bz" rel="nofollow">http://ideone.com/3lx0Bz</a> (auf den Input achten!)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2295895</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295895</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Mon, 04 Feb 2013 09:38:19 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Thu, 12 Jun 2014 11:03:23 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2295902</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295902</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Thu, 12 Jun 2014 11:03:23 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Mon, 04 Feb 2013 10:17:28 GMT]]></title><description><![CDATA[<p>*Popcorn nehm und bequem hinsetz*</p>
<p>Ich glaub das wird lustig <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=";D"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2295912</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295912</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Mon, 04 Feb 2013 10:17:28 GMT</pubDate></item><item><title><![CDATA[Reply to Operatoren gesucht (in do while Schleife) on Thu, 12 Jun 2014 11:03:27 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2295963</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2295963</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Thu, 12 Jun 2014 11:03:27 GMT</pubDate></item></channel></rss>