<?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[Geht es noch besser]]></title><description><![CDATA[<p>Hallo,</p>
<p>Habe heute mein erstes C++ Program ein Taschenrechner programmiert.<br />
Früher programmierte ich immer in C# aber da ich SteamOS (Linux) unterstützen will, bin ich auf C++ umgestiegen.</p>
<p>Der Code meines Taschenrechner (In VS13 programmiert)</p>
<pre><code>// Quelle.cpp
// Quelle.cpp
#include &lt;string&gt;
#include &lt;iostream&gt;
using namespace std;

int main(void)
{

	cout &lt;&lt; &quot;Hallo was wollen Sie rechnen \n a = Addition, m = Multiplikation \n d = Division s = Subtraktion \n&quot;;
	string za = &quot;&quot;;
	  cin &gt;&gt; za;
    cout &lt;&lt; &quot;Bitte geben Sie die erste Zahl ein\n&quot;;
	double x = 0;
	    cin &gt;&gt; x;
	cout &lt;&lt; &quot;Bitte geben Sie die zweite Zahl ein\n&quot;;
	double y = 0;
	    cin &gt;&gt; y;
	cout &lt;&lt; &quot;\n Ihr Ergebnis ist: &quot;;
	if (za == &quot;a&quot;) cout &lt;&lt; x + y &lt;&lt; &quot;\n&quot;;
	else if (za == &quot;m&quot;) cout &lt;&lt; x * y &lt;&lt; &quot;\n&quot;;
	else if (za == &quot;d&quot;) cout &lt;&lt; x / y &lt;&lt; &quot;\n&quot;;
	else if (za == &quot;s&quot;) cout &lt;&lt; x - y &lt;&lt; &quot;\n&quot;;
	cin.ignore().get();
	return 0;
}
</code></pre>
<p>Habt ihr vielleicht eine Idee wie ich das verbessern könnte?<br />
Danke im voraus.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/322452/geht-es-noch-besser</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Jul 2026 22:32:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/322452.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 21 Dec 2013 09:11:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Geht es noch besser on Sat, 21 Dec 2013 10:58:14 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Habe heute mein erstes C++ Program ein Taschenrechner programmiert.<br />
Früher programmierte ich immer in C# aber da ich SteamOS (Linux) unterstützen will, bin ich auf C++ umgestiegen.</p>
<p>Der Code meines Taschenrechner (In VS13 programmiert)</p>
<pre><code>// Quelle.cpp
// Quelle.cpp
#include &lt;string&gt;
#include &lt;iostream&gt;
using namespace std;

int main(void)
{

	cout &lt;&lt; &quot;Hallo was wollen Sie rechnen \n a = Addition, m = Multiplikation \n d = Division s = Subtraktion \n&quot;;
	string za = &quot;&quot;;
	  cin &gt;&gt; za;
    cout &lt;&lt; &quot;Bitte geben Sie die erste Zahl ein\n&quot;;
	double x = 0;
	    cin &gt;&gt; x;
	cout &lt;&lt; &quot;Bitte geben Sie die zweite Zahl ein\n&quot;;
	double y = 0;
	    cin &gt;&gt; y;
	cout &lt;&lt; &quot;\n Ihr Ergebnis ist: &quot;;
	if (za == &quot;a&quot;) cout &lt;&lt; x + y &lt;&lt; &quot;\n&quot;;
	else if (za == &quot;m&quot;) cout &lt;&lt; x * y &lt;&lt; &quot;\n&quot;;
	else if (za == &quot;d&quot;) cout &lt;&lt; x / y &lt;&lt; &quot;\n&quot;;
	else if (za == &quot;s&quot;) cout &lt;&lt; x - y &lt;&lt; &quot;\n&quot;;
	cin.ignore().get();
	return 0;
}
</code></pre>
<p>Habt ihr vielleicht eine Idee wie ich das verbessern könnte?<br />
Danke im voraus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2373119</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2373119</guid><dc:creator><![CDATA[user125]]></dc:creator><pubDate>Sat, 21 Dec 2013 10:58:14 GMT</pubDate></item><item><title><![CDATA[Reply to Geht es noch besser on Sat, 21 Dec 2013 09:20:23 GMT]]></title><description><![CDATA[<p>vor-raus wird zensiert weil es falsch ist, korrekt schreibt man: voraus.</p>
<p>was man verbessern könnte:<br />
- variablen so lokal wie möglich definieren<br />
- &quot;cout &lt;&lt; &quot;Ihr Ergebnis ist: &quot;&quot; ist in allen operations-wegen drin, das kann man auch vor der switch machen<br />
- y muss nicht initialisiert werden. wenn ein built-in-typ initialisiert wird, dann denke ich immer, dass da etwas reingerechnet wird. (was aber hier nicht so ist)<br />
- kleine rechtschreibe fehler (höflichkeitsform gehört gross geschrieben, subtraktion)<br />
- irgend eine absicherung, dass das programm normal weiter läuft wenn der nutzer quatsch eingibt. (dass man einfach nochmals aufgefordert wird es einzugeben)</p>
<p>gruss</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2373120</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2373120</guid><dc:creator><![CDATA[Fytch]]></dc:creator><pubDate>Sat, 21 Dec 2013 09:20:23 GMT</pubDate></item></channel></rss>