<?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[Taschenrechner]]></title><description><![CDATA[<p>Ich lerne momentan C++.<br />
Hab mir ein Buch gekauft, dass bei Ansi C++ beginnt und dann in die Objektorientierte Programmierung in C++ eingeht.</p>
<p>So zum verstehen der Grundkentnisse habe ich einen taschenrechner programmiert, ich würde gerne wissen was ihr davon haltet.</p>
<pre><code class="language-cpp">include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;
int main() 
{ 
	int schluss;
	char x;
		cout &lt;&lt; &quot;			Dies ist ein Taschenrechner\n&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;			Er kann +,-,/ und * rechnen\n&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;			Geben sie das Zeichen ein um mit\n&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;			der gewuenschen Rechenart zu rechnen!\n&quot; &lt;&lt; endl;

	cout &lt;&lt; &quot;Wollen sie +,- ,/ oder * rechnen: &quot;;

	cin &gt;&gt; x;

switch (x) 
  { 
    case '+': 
      { 
        vector&lt;double&gt; v;
  cout &lt;&lt; &quot;Wie viele Werte?:&quot;;
  int anz;
  cin &gt;&gt; anz;
  double addition=0;

  for(int i=1; i&lt;=anz; i++) {
    cout &lt;&lt; &quot;Wert &quot; &lt;&lt; i &lt;&lt; &quot;:&quot;;
    double tmp;
    cin &gt;&gt; tmp;
    addition+=tmp;
  }
  // cout &lt;&lt; &quot;Ergebniss: &quot; &lt;&lt; addition &lt;&lt; endl;
  cout &lt;&lt; v.size();

        break; 
      } 

	case '-': 

      { 
       double zahl1;
		  cout &lt;&lt; &quot;Zahl 1 eingeben:&quot;;
		  cin &gt;&gt; zahl1;
		  double zahl2;
		  cout &lt;&lt; &quot;Zahl 2 eingeben:&quot;;
		  cin &gt;&gt; zahl2;
		  double substraktion = zahl1-zahl2;
		  cout &lt;&lt; zahl1 &lt;&lt; &quot; - &quot; &lt;&lt; zahl2 &lt;&lt; &quot; = &quot; &lt;&lt; substraktion &lt;&lt; endl; 
        break; 
      } 

	case '/': 
      { 
       double zahl1;
		  cout &lt;&lt; &quot;Zahl 1 eingeben:&quot;;
		  cin &gt;&gt; zahl1;
		  double zahl2;
		  cout &lt;&lt; &quot;Zahl 2 eingeben:&quot;;
		  cin &gt;&gt; zahl2;
		  double division = zahl1/zahl2;
		  cout &lt;&lt; zahl1 &lt;&lt; &quot; / &quot; &lt;&lt; zahl2 &lt;&lt; &quot; = &quot; &lt;&lt; division &lt;&lt; endl; 
        break; 
      } 

	case '*': 
     { 
       double zahl1;
		  cout &lt;&lt; &quot;Zahl 1 eingeben:&quot;;
		  cin &gt;&gt; zahl1;
		  double zahl2;
		  cout &lt;&lt; &quot;Zahl 2 eingeben:&quot;;
		  cin &gt;&gt; zahl2;
		  double multi = zahl1*zahl2;
		  cout &lt;&lt; zahl1 &lt;&lt; &quot; * &quot; &lt;&lt; zahl2 &lt;&lt; &quot; = &quot; &lt;&lt; multi &lt;&lt; endl; 
        break; 
      } 

	default: 
      { 
        std::cout &lt;&lt; &quot;Kannst du net +,-,/,* eintippen???&quot; &lt;&lt; std::endl; 
        break; 
      } 
  } 
cout &lt;&lt; &quot;Beliebige Zahl eingeben, dann enter zum Beenden druecken!&quot;;
cin &gt;&gt; schluss; 
return 0;

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/188987/taschenrechner</link><generator>RSS for Node</generator><lastBuildDate>Fri, 03 Jul 2026 04:29:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/188987.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 07 Aug 2007 09:41:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Taschenrechner on Tue, 07 Aug 2007 09:41:00 GMT]]></title><description><![CDATA[<p>Ich lerne momentan C++.<br />
Hab mir ein Buch gekauft, dass bei Ansi C++ beginnt und dann in die Objektorientierte Programmierung in C++ eingeht.</p>
<p>So zum verstehen der Grundkentnisse habe ich einen taschenrechner programmiert, ich würde gerne wissen was ihr davon haltet.</p>
<pre><code class="language-cpp">include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;
int main() 
{ 
	int schluss;
	char x;
		cout &lt;&lt; &quot;			Dies ist ein Taschenrechner\n&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;			Er kann +,-,/ und * rechnen\n&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;			Geben sie das Zeichen ein um mit\n&quot; &lt;&lt; endl;
	cout &lt;&lt; &quot;			der gewuenschen Rechenart zu rechnen!\n&quot; &lt;&lt; endl;

	cout &lt;&lt; &quot;Wollen sie +,- ,/ oder * rechnen: &quot;;

	cin &gt;&gt; x;

switch (x) 
  { 
    case '+': 
      { 
        vector&lt;double&gt; v;
  cout &lt;&lt; &quot;Wie viele Werte?:&quot;;
  int anz;
  cin &gt;&gt; anz;
  double addition=0;

  for(int i=1; i&lt;=anz; i++) {
    cout &lt;&lt; &quot;Wert &quot; &lt;&lt; i &lt;&lt; &quot;:&quot;;
    double tmp;
    cin &gt;&gt; tmp;
    addition+=tmp;
  }
  // cout &lt;&lt; &quot;Ergebniss: &quot; &lt;&lt; addition &lt;&lt; endl;
  cout &lt;&lt; v.size();

        break; 
      } 

	case '-': 

      { 
       double zahl1;
		  cout &lt;&lt; &quot;Zahl 1 eingeben:&quot;;
		  cin &gt;&gt; zahl1;
		  double zahl2;
		  cout &lt;&lt; &quot;Zahl 2 eingeben:&quot;;
		  cin &gt;&gt; zahl2;
		  double substraktion = zahl1-zahl2;
		  cout &lt;&lt; zahl1 &lt;&lt; &quot; - &quot; &lt;&lt; zahl2 &lt;&lt; &quot; = &quot; &lt;&lt; substraktion &lt;&lt; endl; 
        break; 
      } 

	case '/': 
      { 
       double zahl1;
		  cout &lt;&lt; &quot;Zahl 1 eingeben:&quot;;
		  cin &gt;&gt; zahl1;
		  double zahl2;
		  cout &lt;&lt; &quot;Zahl 2 eingeben:&quot;;
		  cin &gt;&gt; zahl2;
		  double division = zahl1/zahl2;
		  cout &lt;&lt; zahl1 &lt;&lt; &quot; / &quot; &lt;&lt; zahl2 &lt;&lt; &quot; = &quot; &lt;&lt; division &lt;&lt; endl; 
        break; 
      } 

	case '*': 
     { 
       double zahl1;
		  cout &lt;&lt; &quot;Zahl 1 eingeben:&quot;;
		  cin &gt;&gt; zahl1;
		  double zahl2;
		  cout &lt;&lt; &quot;Zahl 2 eingeben:&quot;;
		  cin &gt;&gt; zahl2;
		  double multi = zahl1*zahl2;
		  cout &lt;&lt; zahl1 &lt;&lt; &quot; * &quot; &lt;&lt; zahl2 &lt;&lt; &quot; = &quot; &lt;&lt; multi &lt;&lt; endl; 
        break; 
      } 

	default: 
      { 
        std::cout &lt;&lt; &quot;Kannst du net +,-,/,* eintippen???&quot; &lt;&lt; std::endl; 
        break; 
      } 
  } 
cout &lt;&lt; &quot;Beliebige Zahl eingeben, dann enter zum Beenden druecken!&quot;;
cin &gt;&gt; schluss; 
return 0;

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1339986</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1339986</guid><dc:creator><![CDATA[xxSeppelxx]]></dc:creator><pubDate>Tue, 07 Aug 2007 09:41:00 GMT</pubDate></item><item><title><![CDATA[Reply to Taschenrechner on Tue, 07 Aug 2007 10:55:05 GMT]]></title><description><![CDATA[<p>Falsches Unterforum! Inm C++-Forum nochmal posten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1340058</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1340058</guid><dc:creator><![CDATA[Elektronix]]></dc:creator><pubDate>Tue, 07 Aug 2007 10:55:05 GMT</pubDate></item><item><title><![CDATA[Reply to Taschenrechner on Tue, 07 Aug 2007 11:15:02 GMT]]></title><description><![CDATA[<p>Hey xxSeppexx,<br />
ansich ganz nett aber versuch doch mal einen Taschenrechner zuschreiben der beliebig viele Zahlen mit ein ander verrechnen kann. In etwa so:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;conio.h&gt;

using namespace std;

long double ergebnis=0,zahl=0;
char rechenzeichen;

int main()
{
    cout &lt;&lt; &quot; Taschenrecher \n ------------------------------- \n\n Term &gt; &quot;;
    cin &gt;&gt; ergebnis;
    while (true)
    {
        cin &gt;&gt; rechenzeichen;
        if (rechenzeichen == '=')
        {
            cout &lt;&lt; &quot; Ergebnis = &quot;&lt;&lt;ergebnis&lt;&lt;endl;
            break;
        }
        cin &gt;&gt; zahl;
        if (rechenzeichen == '+')
        {
            ergebnis = ergebnis + zahl;
        }
        if (rechenzeichen == '-')
        {
            ergebnis = ergebnis - zahl;
        }
        if (rechenzeichen == '*')
        {
            ergebnis = ergebnis * zahl;
        }
        if (rechenzeichen == '/')
        {
            ergebnis = ergebnis / zahl;
        }
    }
    getch();
    return 0;
}
</code></pre>
<blockquote>
<p>PS :<br />
Ich denke das du oben das Raute zeichen vergessen hast war ein kopier Fehler, aber bei &quot;std::cout &lt;&lt; &quot;Kannst du net +,-,/,* eintippen???&quot; &lt;&lt; std::endl;&quot;<br />
da kannst du std:: weg lassen.</p>
</blockquote>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1340062</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1340062</guid><dc:creator><![CDATA[char i*69**]]></dc:creator><pubDate>Tue, 07 Aug 2007 11:15:02 GMT</pubDate></item><item><title><![CDATA[Reply to Taschenrechner on Wed, 08 Aug 2007 06:31:10 GMT]]></title><description><![CDATA[<p>Ich habe in BASIC mal so etwas gemacht, da kann man immerhin nach jedem Resultat mit einer weiteren Zahl &quot;weitermachen&quot;:</p>
<pre><code>dim as double A, B

100:input &quot;Eingabe Zahl 1 &quot;; A

200:print &quot;1 fuer addieren +, 2 fuer multiplizieren *,&quot; 
210: input &quot;3 fuer dividieren /, 4 fuer subtrahieren -&quot;; D
300:input &quot;Zahl 2 &quot;; B
dim C as double

asm
    mov eax, [D]
    cmp eax, 1
    je M2
    cmp eax, 2
    je M10
    cmp eax, 3
    je M20
    cmp eax, 4
    je M30

    M2: fld qword ptr [_A] 
    fadd qword ptr [_B] 
    fstp qword ptr [_C] 

    jmp M40

    M10: fld qword ptr [_A] 
    fmul qword ptr [_B] 
    fstp qword ptr [_C] 

    jmp M40

    M20: fld qword ptr [_A] 
    fdiv qword ptr [_B] 
    fstp qword ptr [_C] 

    jmp M40

    M30:fld qword ptr [_A] 
    fsub qword ptr [_B] 
    fstp qword ptr [_C] 

    jmp M40
    M40: nop
end asm

print C
sleep 1000
input &quot;Noch eine Berechnung (mit diesem Resultat oder neuen Zahlen)? j/n&quot;; H$

If H$=&quot;j&quot; goto 2000
if H$=&quot;n&quot; goto 5000

2000: Dim Erg2 As Integer

input &quot;Dieses Resultat (oder neue Zahlen) verwenden ? j/n&quot;; I$

If I$ = &quot;j&quot; goto 2500 
if I$= &quot;n&quot; goto 100

2500: 

A=C

goto 200

5000:Declare Function MessageBox Lib &quot;user32&quot; Alias &quot;MessageBoxA&quot; _
   (ByVal hWnd As Integer, ByVal lpText As String, _
   ByVal lpCaption As String, ByVal wType As Integer) As Integer

Const fbOkOnly = 0            'Nur die Schaltfläche OK anzeigen
Const fbOkCancel = 1          'Schaltflächen OK und Abbrechen anzeigen
Const fbAbortRetryIgnore = 2  'Abbruch, Wiederholen und Ignorieren
Const fbYesNoCancel = 3       'Ja, Nein und Abbrechen
Const fbYesNo = 4             'Schaltflächen Ja und Nein
Const fbRetryCancel = 5       'Schaltflächen Wiederholen und Abbrechen
Const fbCritical = 16         'Stop-Symbol
Const fbQuestion = 32         'Fragezeichen-Symbol
Const fbExclamation = 48      'Ausrufezeichen-Symbol
Const fbInformation = 64      'Information-Symbol

Dim s As Integer

s = MessageBox (me.hWnd, &quot;Dieses Programm wurde grösstenteils in Assemblersprache geschrieben! © C. M . Obrecht, 2006&quot;, &quot;I n f o r m a t i o n &quot;,fbExclamation)
s = MessageBox (me.hWnd, &quot;Auf Wiedersehen&quot;, &quot;    :-)   &quot;,fbInformation)

End
</code></pre>
<p>und für DOS mit VB: <a href="http://www.homepage.hispeed.ch/reben/Rechner.exe" rel="nofollow">www.homepage.hispeed.ch/reben/Rechner.exe</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1340519</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1340519</guid><dc:creator><![CDATA[C. M. Obrecht]]></dc:creator><pubDate>Wed, 08 Aug 2007 06:31:10 GMT</pubDate></item></channel></rss>