<?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[Ziffern anhängen]]></title><description><![CDATA[<p>Hallo zusammen,<br />
ich habe gerade ein paar Syntaxprobleme. Ich möchte über cin eine Zahl angeben und diese soll dann einfach an die zuletzt eingegeben Zahl angehängt werden.</p>
<p>Also so:</p>
<p>Zahl1 = 3<br />
Ich gebe nun 5 ein:<br />
Zahl1+=5 --&gt; 35 //;)</p>
<p>Ich möchte, dass nur eine Variable gebraucht wird, aber das hier funzt ja definiert nicht:</p>
<p>zahl=zahl+cin&gt;&gt;zahl;</p>
<p>Wie kann ich das machen?<br />
Vielen Dank<br />
lg, freakC++</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/250529/ziffern-anhängen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 00:38:28 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/250529.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 19 Sep 2009 14:51:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ziffern anhängen on Sat, 19 Sep 2009 14:51:35 GMT]]></title><description><![CDATA[<p>Hallo zusammen,<br />
ich habe gerade ein paar Syntaxprobleme. Ich möchte über cin eine Zahl angeben und diese soll dann einfach an die zuletzt eingegeben Zahl angehängt werden.</p>
<p>Also so:</p>
<p>Zahl1 = 3<br />
Ich gebe nun 5 ein:<br />
Zahl1+=5 --&gt; 35 //;)</p>
<p>Ich möchte, dass nur eine Variable gebraucht wird, aber das hier funzt ja definiert nicht:</p>
<p>zahl=zahl+cin&gt;&gt;zahl;</p>
<p>Wie kann ich das machen?<br />
Vielen Dank<br />
lg, freakC++</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1781449</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1781449</guid><dc:creator><![CDATA[freakC++]]></dc:creator><pubDate>Sat, 19 Sep 2009 14:51:35 GMT</pubDate></item><item><title><![CDATA[Reply to Ziffern anhängen on Sat, 19 Sep 2009 14:55:10 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">void append(int&amp; num) {
  int tmp;
  cin &gt;&gt; tmp;
  num = num*10 + tmp;
}

//
int Zahl;
append(Zahl);
append(Zahl);
</code></pre>
<p>z.B.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1781451</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1781451</guid><dc:creator><![CDATA[Rotiererer]]></dc:creator><pubDate>Sat, 19 Sep 2009 14:55:10 GMT</pubDate></item><item><title><![CDATA[Reply to Ziffern anhängen on Sat, 19 Sep 2009 14:55:49 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;iostream&gt;

int main ()
{
 int zahl = 22;
 int temp = 0;
 std::cin &gt;&gt; temp;

 zahl *= 10;
 zahl += temp;
}
</code></pre>
<p>Ich bezweifle, dass es ohne eine temporäre Zahl geht..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1781454</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1781454</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sat, 19 Sep 2009 14:55:49 GMT</pubDate></item><item><title><![CDATA[Reply to Ziffern anhängen on Sat, 19 Sep 2009 15:00:20 GMT]]></title><description><![CDATA[<p>freakC++ schrieb:</p>
<blockquote>
<p>Ich möchte, dass nur eine Variable gebraucht wird</p>
</blockquote>
<p>Warum?</p>
<p>edit:<br />
Und hier eine (ungetestete) Möglichkeit, sofern du einen Iterator nicht als Variable ansiehst:</p>
<pre><code class="language-cpp">istream_iterator&lt;int&gt; in (cin);  

int zahl=(*in) * 10;

in++;
zahl += *in;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1781455</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1781455</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sat, 19 Sep 2009 15:00:20 GMT</pubDate></item><item><title><![CDATA[Reply to Ziffern anhängen on Sat, 19 Sep 2009 15:10:03 GMT]]></title><description><![CDATA[<p>Hallo,<br />
das mit einer Variable war nicht so geistreich! Es dürfen auch mehrere sein.</p>
<p>Vielen Dank für eure Hilfe!</p>
<p>lg, freakC++</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1781461</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1781461</guid><dc:creator><![CDATA[freakC++]]></dc:creator><pubDate>Sat, 19 Sep 2009 15:10:03 GMT</pubDate></item><item><title><![CDATA[Reply to Ziffern anhängen on Sat, 19 Sep 2009 15:20:39 GMT]]></title><description><![CDATA[<p>freakC++ schrieb:</p>
<blockquote>
<p>Hallo,<br />
das mit einer Variable war nicht so geistreich! Es dürfen auch mehrere sein.</p>
<p>Vielen Dank für eure Hilfe!</p>
<p>lg, freakC++</p>
</blockquote>
<p>Dann bekommst du es aber doch selber hin, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1781464</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1781464</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sat, 19 Sep 2009 15:20:39 GMT</pubDate></item><item><title><![CDATA[Reply to Ziffern anhängen on Sat, 19 Sep 2009 15:26:14 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int main()
{
    std::string ZahlAlsString;
    int ZahlAlsZahl;

    while(true) //oder was auch immmer
    {
        char ziffer;
        cin&gt;&gt;ziffer;
        ZahlAlsString+=ziffer;
        std::stringstream Str; 
        if(Str&lt;&lt;ZahlAlsString) ; //ggf exeption
        if(Str&gt;&gt;ZahlAlsZahl); //ggf exeption
    }
}
</code></pre>
<p>Ist nicht wirklich performant aber einfach zu verstehen und Sicher</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1781465</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1781465</guid><dc:creator><![CDATA[sdfsdf]]></dc:creator><pubDate>Sat, 19 Sep 2009 15:26:14 GMT</pubDate></item></channel></rss>