<?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[Sprünge im Code]]></title><description><![CDATA[<p>Ich möchte es so prgrammieren, dass wenn das Programm also der Nutzer die Rechnung vollzogen hat, dass er gefragt wird ob er eine neue Rechnung berechnen soll also, dass er wieder zur Zeile 12 springt wo der Chat gesäubert wird und wieder die Anzeige erscheint wie er es eingeben muss um ein erfolgreiche Rechnung zu vollziehen</p>
<pre><code>#import &lt;iostream&gt;
#import &lt;windows.h&gt;

int Zahl1, Zahl2, Ergebnis;
char Operation;

int main()
{	
	system(&quot;cls&quot;);
	std::cout &lt;&lt; &quot;Syntax: &lt;Zahl1&gt; + | - | * | / | % &lt;Zahl2&gt; = Ergebnis&quot; &lt;&lt; std::endl &lt;&lt; std::endl;
	Sleep(2*1000);

	std::cout &lt;&lt; &quot;Geben Sie die erste Zahl ein: &quot;;
	std::cin &gt;&gt; Zahl1;
	std::cout &lt;&lt; std::endl;
	std::cout &lt;&lt; &quot;Geben Sie die zweite Zahl ein: &quot;;
	std::cin &gt;&gt; Zahl2;
	std::cout &lt;&lt; std::endl;

	std::cout &lt;&lt; &quot;Geben Sie als nächstes die Rechenoperation ein mit der Sie rechnen wollen: &quot;;
	std::cin &gt;&gt; Operation;
	std::cout &lt;&lt; std::endl;	

	switch(Operation)
	{
		case '+':
			Ergebnis = Zahl1 + Zahl2;
			std::cout &lt;&lt; &quot;Das Ergebnis ist: &quot; &lt;&lt; Ergebnis &lt;&lt; std::endl;
			break;
		case '-':
			Ergebnis = Zahl1 - Zahl2;
			std::cout &lt;&lt; &quot;Das Ergebnis ist: &quot; &lt;&lt; Ergebnis &lt;&lt; std::endl;
			break;
		case '*':
			Ergebnis = Zahl1 * Zahl2;
			std::cout &lt;&lt; &quot;Das Ergebnis ist: &quot; &lt;&lt; Ergebnis &lt;&lt; std::endl;
			break;
		case '/':
			if(Zahl1 || Zahl2 == 0)
			{
				std::cout &lt;&lt; (&quot;ERROR! Programm beendet vorzeitig um sich nicht zu schaden!&quot;) &lt;&lt; std::endl &lt;&lt; std::endl;
				Sleep(1000);
				return 0;
			}
			Ergebnis = Zahl1 / Zahl2;
			std::cout &lt;&lt; &quot;Das Ergebnis ist: &quot; &lt;&lt; Ergebnis &lt;&lt; std::endl;
			break;
		case '%':
			Ergebnis = Zahl1 % Zahl2;
			std::cout &lt;&lt; &quot;Der Rest ist: &quot; &lt;&lt; Ergebnis &lt;&lt; std::endl;
			break;
		default:
			std::cout &lt;&lt; &quot;Falsche eingabe: &quot; &lt;&lt; Operation &lt;&lt; std::endl;
			break;		

	}

	system(&quot;PAUSE&quot;);
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/331889/sprünge-im-code</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 01:55:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/331889.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 26 Mar 2015 19:25:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Sprünge im Code on Thu, 26 Mar 2015 19:25:03 GMT]]></title><description><![CDATA[<p>Ich möchte es so prgrammieren, dass wenn das Programm also der Nutzer die Rechnung vollzogen hat, dass er gefragt wird ob er eine neue Rechnung berechnen soll also, dass er wieder zur Zeile 12 springt wo der Chat gesäubert wird und wieder die Anzeige erscheint wie er es eingeben muss um ein erfolgreiche Rechnung zu vollziehen</p>
<pre><code>#import &lt;iostream&gt;
#import &lt;windows.h&gt;

int Zahl1, Zahl2, Ergebnis;
char Operation;

int main()
{	
	system(&quot;cls&quot;);
	std::cout &lt;&lt; &quot;Syntax: &lt;Zahl1&gt; + | - | * | / | % &lt;Zahl2&gt; = Ergebnis&quot; &lt;&lt; std::endl &lt;&lt; std::endl;
	Sleep(2*1000);

	std::cout &lt;&lt; &quot;Geben Sie die erste Zahl ein: &quot;;
	std::cin &gt;&gt; Zahl1;
	std::cout &lt;&lt; std::endl;
	std::cout &lt;&lt; &quot;Geben Sie die zweite Zahl ein: &quot;;
	std::cin &gt;&gt; Zahl2;
	std::cout &lt;&lt; std::endl;

	std::cout &lt;&lt; &quot;Geben Sie als nächstes die Rechenoperation ein mit der Sie rechnen wollen: &quot;;
	std::cin &gt;&gt; Operation;
	std::cout &lt;&lt; std::endl;	

	switch(Operation)
	{
		case '+':
			Ergebnis = Zahl1 + Zahl2;
			std::cout &lt;&lt; &quot;Das Ergebnis ist: &quot; &lt;&lt; Ergebnis &lt;&lt; std::endl;
			break;
		case '-':
			Ergebnis = Zahl1 - Zahl2;
			std::cout &lt;&lt; &quot;Das Ergebnis ist: &quot; &lt;&lt; Ergebnis &lt;&lt; std::endl;
			break;
		case '*':
			Ergebnis = Zahl1 * Zahl2;
			std::cout &lt;&lt; &quot;Das Ergebnis ist: &quot; &lt;&lt; Ergebnis &lt;&lt; std::endl;
			break;
		case '/':
			if(Zahl1 || Zahl2 == 0)
			{
				std::cout &lt;&lt; (&quot;ERROR! Programm beendet vorzeitig um sich nicht zu schaden!&quot;) &lt;&lt; std::endl &lt;&lt; std::endl;
				Sleep(1000);
				return 0;
			}
			Ergebnis = Zahl1 / Zahl2;
			std::cout &lt;&lt; &quot;Das Ergebnis ist: &quot; &lt;&lt; Ergebnis &lt;&lt; std::endl;
			break;
		case '%':
			Ergebnis = Zahl1 % Zahl2;
			std::cout &lt;&lt; &quot;Der Rest ist: &quot; &lt;&lt; Ergebnis &lt;&lt; std::endl;
			break;
		default:
			std::cout &lt;&lt; &quot;Falsche eingabe: &quot; &lt;&lt; Operation &lt;&lt; std::endl;
			break;		

	}

	system(&quot;PAUSE&quot;);
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2448127</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2448127</guid><dc:creator><![CDATA[crazyyzarc]]></dc:creator><pubDate>Thu, 26 Mar 2015 19:25:03 GMT</pubDate></item><item><title><![CDATA[Reply to Sprünge im Code on Thu, 26 Mar 2015 19:26:42 GMT]]></title><description><![CDATA[<p>While oder Do-While Schleife?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2448128</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2448128</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Thu, 26 Mar 2015 19:26:42 GMT</pubDate></item><item><title><![CDATA[Reply to Sprünge im Code on Thu, 26 Mar 2015 19:48:47 GMT]]></title><description><![CDATA[<p>crazyyzarc schrieb:</p>
<blockquote>
<pre><code>std::cout &lt;&lt; (&quot;ERROR! Programm beendet vorzeitig um sich nicht zu schaden!&quot;) &lt;&lt; std::endl &lt;&lt; std::endl;
</code></pre>
</blockquote>
<p>Ha, ha, hab ich ich heute doch noch was zum Lachen geschenkt bekommen.</p>
<p>Ich kenne zwar self modifying code, aber self damaging code war mir neu.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2448129</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2448129</guid><dc:creator><![CDATA[EOP]]></dc:creator><pubDate>Thu, 26 Mar 2015 19:48:47 GMT</pubDate></item><item><title><![CDATA[Reply to Sprünge im Code on Thu, 26 Mar 2015 19:41:45 GMT]]></title><description><![CDATA[<p>wie mach ich dass denn? Ich mag eher die while-Schleife die do-whilfe Schleife ist mir bisschen kompliziert obwohl ich genau weiß wie sie funktioniert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2448130</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2448130</guid><dc:creator><![CDATA[crazyyzarc]]></dc:creator><pubDate>Thu, 26 Mar 2015 19:41:45 GMT</pubDate></item><item><title><![CDATA[Reply to Sprünge im Code on Thu, 26 Mar 2015 19:52:24 GMT]]></title><description><![CDATA[<p>crazyyzarc schrieb:</p>
<blockquote>
<p>wie mach ich dass denn? Ich mag eher die while-Schleife die do-whilfe Schleife ist mir bisschen kompliziert obwohl ich genau weiß wie sie funktioniert</p>
</blockquote>
<p>Wo genau ist das Problem? Vielleicht übst du mal an einem Miniprogramm eine Schleife, um Berührungsängste zu vermeiden:<br />
1. Übung: Nutze eine while- oder do-while-Schleife, um die Zahlen 1 bis 10 auszugeben<br />
2. Übung: Schreibe ein Programm, welches Buchstaben einliest. Wird ein 'e' eingelesen, soll das Programm beendet werden. Nutze eine while oder do-while Schleife.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2448131</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2448131</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Thu, 26 Mar 2015 19:52:24 GMT</pubDate></item><item><title><![CDATA[Reply to Sprünge im Code on Thu, 26 Mar 2015 21:21:55 GMT]]></title><description><![CDATA[<p>Zeile 42: Hier kann es zu einem DivByZero-Fehler kommen oder? Weil wenn Zahl1 ungleich 0 nicht mehr Zahl2 geprüfte wird.</p>
<p>Sorry falls ich Mist erzähle, bin noch nicht so lange dabei.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2448135</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2448135</guid><dc:creator><![CDATA[Brabbel]]></dc:creator><pubDate>Thu, 26 Mar 2015 21:21:55 GMT</pubDate></item><item><title><![CDATA[Reply to Sprünge im Code on Thu, 26 Mar 2015 22:20:52 GMT]]></title><description><![CDATA[<p>Brabbel schrieb:</p>
<blockquote>
<p>Zeile 42: Hier kann es zu einem DivByZero-Fehler kommen oder? Weil wenn Zahl1 ungleich 0 nicht mehr Zahl2 geprüfte wird.</p>
</blockquote>
<p>Korrekt, diese Abfrage ist Unsinn (denn sie bedeutet nicht, &quot;falls zahl1 gleich 0 oder zahll2 gleich 0&quot;). Weiterhin darf man auch nicht durch 0 modulo'en und andererseits darf man aber gerne 0 durch eine andere Zahl teilen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2448140</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2448140</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Thu, 26 Mar 2015 22:20:52 GMT</pubDate></item><item><title><![CDATA[Reply to Sprünge im Code on Fri, 27 Mar 2015 00:06:08 GMT]]></title><description><![CDATA[<p>crazyyzarc schrieb:</p>
<blockquote>
<p>Ich mag eher die while-Schleife die do-whilfe Schleife ist mir bisschen kompliziert obwohl ich genau weiß wie sie funktioniert</p>
</blockquote>
<p>Wenn du verstanden hast wie sie funktionieren solltest du dir mal den Unterschied vor Augen führen, vielleicht hast du dann auch keine Probleme mehr mit der do-while <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>
]]></description><link>https://www.c-plusplus.net/forum/post/2448142</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2448142</guid><dc:creator><![CDATA[snwFlake]]></dc:creator><pubDate>Fri, 27 Mar 2015 00:06:08 GMT</pubDate></item></channel></rss>