<?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[Mit alten Werten weiterrechnen]]></title><description><![CDATA[<p>Hallo Community,</p>
<p>ich bin momentan dabei einen umfangreichen Taschenrechner zu programmieren. Und ich bin mit diesem Abschnitt nicht zufrieden</p>
<pre><code>#include &lt;iostream&gt;
using namespace std;

long double a;
long double b;
int x;
long double Ergebnis = Ergebnis + a;

int main () {

do {

cout &lt;&lt; &quot; Wählen Sie eine Option &quot; &lt;&lt; endl; // Mehrere Optionen
cout &lt;&lt; &quot; Addition (1) &quot; &lt;&lt; endl;
cin &gt;&gt; x;

switch (x){
case 1:

cout &lt;&lt; &quot; Beenden mit Ja(1), Nein (2) &quot; &lt;&lt; endl;
            cin &gt;&gt; x;
            if (x==2) {
                while (x==2) {
            cout &lt;&lt; &quot; Bitte 2 Werte angeben\n &quot;;
            cin &gt;&gt; a;

                cout &lt;&lt; &quot; + &quot; &lt;&lt; endl;
                cout &lt;&lt; &quot; &quot;; cin &gt;&gt; b;
                cout &lt;&lt; &quot; = &quot; &lt;&lt; endl;
                Ergebnis = Ergebnis + a + b;
                cout &lt;&lt; &quot; &quot; &lt;&lt; Ergebnis;
                cout &lt;&lt; &quot; Neue Rechnung mit altem Wert? &quot; &lt;&lt; endl;
                cout &lt;&lt; &quot; (1) Ja, (2) Nein &quot; &lt;&lt; endl;
                cin &gt;&gt; x;
                                if ( x == 1) {
                    cout &lt;&lt; &quot; Mit 0 Aufgabenende &quot; &lt;&lt; endl;
                while (a!=0) {
                    cout &lt;&lt; &quot; Neue Zahl: &quot; &lt;&lt; endl;
                    cout &lt;&lt; Ergebnis  &lt;&lt; endl;
                        cout &lt;&lt; &quot; + &quot; &lt;&lt; endl;
                    cout &lt;&lt; &quot; &quot;; cin &gt;&gt; a;
                    cout &lt;&lt; &quot; &quot; &lt;&lt; &quot; + &quot; &lt;&lt; endl;
                    Ergebnis = Ergebnis + a;
                    cout &lt;&lt; &quot; &quot; &lt;&lt; &quot; = &quot; &lt;&lt; Ergebnis &lt;&lt; endl;

                }  
                }
                }
            }
            else
                cout &lt;&lt; endl &lt;&lt; &quot;---------------&quot; &lt;&lt; endl;
                        break;

default:
return 1;
}
}
while (x!=14);
return 0;
}
</code></pre>
<p>Ich weiß das Google mein Freund ist, aber wenn es hierum geht anscheinend nicht.</p>
<p>Sieht extrem umfangreich aus, für so ne kleine Aufgabe, deshalb denke ich das es eine Alternativlösung gibt.<br />
Ich kann dann zwar mit den alten Ergebnissen weiterrechnen, aber dann auch nur in diesem Fall(der Addition), ich will wenn möglich sogar mit den alten Werten subtrahieren, multiplizieren, die Wurzel ziehen u.v.m.<br />
Es wäre nett, wenn mir jemand einen Schubser von der Seite geben würde.</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/322383/mit-alten-werten-weiterrechnen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Jul 2026 21:37:34 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/322383.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 17 Dec 2013 20:36:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Mit alten Werten weiterrechnen on Tue, 17 Dec 2013 20:36:55 GMT]]></title><description><![CDATA[<p>Hallo Community,</p>
<p>ich bin momentan dabei einen umfangreichen Taschenrechner zu programmieren. Und ich bin mit diesem Abschnitt nicht zufrieden</p>
<pre><code>#include &lt;iostream&gt;
using namespace std;

long double a;
long double b;
int x;
long double Ergebnis = Ergebnis + a;

int main () {

do {

cout &lt;&lt; &quot; Wählen Sie eine Option &quot; &lt;&lt; endl; // Mehrere Optionen
cout &lt;&lt; &quot; Addition (1) &quot; &lt;&lt; endl;
cin &gt;&gt; x;

switch (x){
case 1:

cout &lt;&lt; &quot; Beenden mit Ja(1), Nein (2) &quot; &lt;&lt; endl;
            cin &gt;&gt; x;
            if (x==2) {
                while (x==2) {
            cout &lt;&lt; &quot; Bitte 2 Werte angeben\n &quot;;
            cin &gt;&gt; a;

                cout &lt;&lt; &quot; + &quot; &lt;&lt; endl;
                cout &lt;&lt; &quot; &quot;; cin &gt;&gt; b;
                cout &lt;&lt; &quot; = &quot; &lt;&lt; endl;
                Ergebnis = Ergebnis + a + b;
                cout &lt;&lt; &quot; &quot; &lt;&lt; Ergebnis;
                cout &lt;&lt; &quot; Neue Rechnung mit altem Wert? &quot; &lt;&lt; endl;
                cout &lt;&lt; &quot; (1) Ja, (2) Nein &quot; &lt;&lt; endl;
                cin &gt;&gt; x;
                                if ( x == 1) {
                    cout &lt;&lt; &quot; Mit 0 Aufgabenende &quot; &lt;&lt; endl;
                while (a!=0) {
                    cout &lt;&lt; &quot; Neue Zahl: &quot; &lt;&lt; endl;
                    cout &lt;&lt; Ergebnis  &lt;&lt; endl;
                        cout &lt;&lt; &quot; + &quot; &lt;&lt; endl;
                    cout &lt;&lt; &quot; &quot;; cin &gt;&gt; a;
                    cout &lt;&lt; &quot; &quot; &lt;&lt; &quot; + &quot; &lt;&lt; endl;
                    Ergebnis = Ergebnis + a;
                    cout &lt;&lt; &quot; &quot; &lt;&lt; &quot; = &quot; &lt;&lt; Ergebnis &lt;&lt; endl;

                }  
                }
                }
            }
            else
                cout &lt;&lt; endl &lt;&lt; &quot;---------------&quot; &lt;&lt; endl;
                        break;

default:
return 1;
}
}
while (x!=14);
return 0;
}
</code></pre>
<p>Ich weiß das Google mein Freund ist, aber wenn es hierum geht anscheinend nicht.</p>
<p>Sieht extrem umfangreich aus, für so ne kleine Aufgabe, deshalb denke ich das es eine Alternativlösung gibt.<br />
Ich kann dann zwar mit den alten Ergebnissen weiterrechnen, aber dann auch nur in diesem Fall(der Addition), ich will wenn möglich sogar mit den alten Werten subtrahieren, multiplizieren, die Wurzel ziehen u.v.m.<br />
Es wäre nett, wenn mir jemand einen Schubser von der Seite geben würde.</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2372452</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2372452</guid><dc:creator><![CDATA[Tryharder]]></dc:creator><pubDate>Tue, 17 Dec 2013 20:36:55 GMT</pubDate></item><item><title><![CDATA[Reply to Mit alten Werten weiterrechnen on Tue, 17 Dec 2013 21:38:20 GMT]]></title><description><![CDATA[<p>Tryharder schrieb:</p>
<blockquote>
<p>Sieht extrem umfangreich aus, für so ne kleine Aufgabe, deshalb denke ich das es eine Alternativlösung gibt.</p>
</blockquote>
<p>Was kennst du denn schon? Sind eigene Funktionen bekannt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2372465</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2372465</guid><dc:creator><![CDATA[mega slocs]]></dc:creator><pubDate>Tue, 17 Dec 2013 21:38:20 GMT</pubDate></item><item><title><![CDATA[Reply to Mit alten Werten weiterrechnen on Tue, 17 Dec 2013 23:14:45 GMT]]></title><description><![CDATA[<p>mega slocs schrieb:</p>
<blockquote>
<p>Tryharder schrieb:</p>
<blockquote>
<p>Sieht extrem umfangreich aus, für so ne kleine Aufgabe, deshalb denke ich das es eine Alternativlösung gibt.</p>
</blockquote>
<p>Was kennst du denn schon? Sind eigene Funktionen bekannt?</p>
</blockquote>
<p>Willst du jetzt von mir wissen, ob ich Funktionstypen kenne? Wenn ja, dann kann ich als Antwort nur void und int nennen.<br />
Wenn du wissen willst ob noch andere Funktionen in diesem Programm beinhaltet sind, dann ja. Ich hab gar nicht gesagt, dass ich noch Anfänger bin, ich programmiere erst seit 1 Woche, also kann ich nicht sooo viel wissen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2372489</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2372489</guid><dc:creator><![CDATA[Tryharder]]></dc:creator><pubDate>Tue, 17 Dec 2013 23:14:45 GMT</pubDate></item><item><title><![CDATA[Reply to Mit alten Werten weiterrechnen on Wed, 11 Jun 2014 22:33:28 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2372494</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2372494</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Wed, 11 Jun 2014 22:33:28 GMT</pubDate></item><item><title><![CDATA[Reply to Mit alten Werten weiterrechnen on Sat, 21 Dec 2013 17:22:04 GMT]]></title><description><![CDATA[<p>Danke dir Swordfish, bei mir siehts jetzt so aus:</p>
<pre><code>cout &lt;&lt; &quot; Geben Sie eine Zahl an &quot; &lt;&lt; endl;

					do {
					cout &lt;&lt; Ergebnis &lt;&lt; endl;
					cout &lt;&lt; &quot; + &quot; &lt;&lt; endl;
					cin &gt;&gt; x;
					Ergebnis = Ergebnis + x;
					cout &lt;&lt; &quot; = &quot; &lt;&lt; endl;
					cout &lt;&lt; Ergebnis &lt;&lt; endl;
			}
				while (x!=0);
</code></pre>
<p>Jetzt brauch ich noch eine elegenate Art Werte zu löschen, also muss ich mich anscheinend mit Zeigern vertraut machen <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/2373186</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2373186</guid><dc:creator><![CDATA[Tryharder]]></dc:creator><pubDate>Sat, 21 Dec 2013 17:22:04 GMT</pubDate></item><item><title><![CDATA[Reply to Mit alten Werten weiterrechnen on Wed, 11 Jun 2014 22:33:32 GMT]]></title><description><![CDATA[<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2373187</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2373187</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Wed, 11 Jun 2014 22:33:32 GMT</pubDate></item><item><title><![CDATA[Reply to Mit alten Werten weiterrechnen on Sat, 21 Dec 2013 20:28:44 GMT]]></title><description><![CDATA[<p>Man kann auch x = x - x; als option haben.<br />
Aber mit delete kann man ja Variablenwerte löschen oder nicht? Und dafür brauche ich doch Zeiger????<br />
Hast mich jetzt verwirrt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2373208</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2373208</guid><dc:creator><![CDATA[Tryharder]]></dc:creator><pubDate>Sat, 21 Dec 2013 20:28:44 GMT</pubDate></item><item><title><![CDATA[Reply to Mit alten Werten weiterrechnen on Sat, 21 Dec 2013 20:47:45 GMT]]></title><description><![CDATA[<p>Nein, mit delete kann man keine Variableninhalte löschen. delete gibt Speicher frei.<br />
Ja, für delete bräuchte man Zeiger. Man hantiert in C++ aber nicht manuell mit Speicher herum.<br />
Definiere was du mit löschen meinst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2373212</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2373212</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sat, 21 Dec 2013 20:47:45 GMT</pubDate></item><item><title><![CDATA[Reply to Mit alten Werten weiterrechnen on Sat, 21 Dec 2013 20:52:58 GMT]]></title><description><![CDATA[<p>Nathan schrieb:</p>
<blockquote>
<p>Nein, mit delete kann man keine Variableninhalte löschen. delete gibt Speicher frei.<br />
Ja, für delete bräuchte man Zeiger. Man hantiert in C++ aber nicht manuell mit Speicher herum.<br />
Definiere was du mit löschen meinst.</p>
</blockquote>
<p>Den Wert der Variable zurücksetzen, löschen war unglücklich formuliert.<br />
Hmm ich hatte ja:</p>
<pre><code>Ergebnis = 0;
</code></pre>
<p>und habe den Wert für Ergebnis immer wieder geändert, das kann ich ja jetzt. Nun möchte ich den Wert der Variable zurücksetzen, löschen war wirklich unglücklich formuliert. Was brauche ich dafür?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2373214</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2373214</guid><dc:creator><![CDATA[Tryharder]]></dc:creator><pubDate>Sat, 21 Dec 2013 20:52:58 GMT</pubDate></item></channel></rss>