<?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[Anfängerfrage: Große Zahlen mit cin]]></title><description><![CDATA[<p>Hey,</p>
<p>ich arbeite auf Hinweis einiger von euch nun ein C++ Buch durch und stehe hierbei vor einem Problem:</p>
<pre><code>using namespace std;

unsigned long int max_c;

int _tmain(int argc, _TCHAR* argv[])
{

	cin &gt;&gt; max_c;
	cout &lt;&lt; max_c;

	cin.sync();
	cin.get();
	return 0;
}
</code></pre>
<p>Das Problem steckt anscheinend bei cin &gt;&gt; max_c;. Laut der limits.h (<a href="http://www.cplusplus.com/reference/climits/" rel="nofollow">www.cplusplus.com/reference/climits/</a>) sollte dieser Datentyp ja sehr große Zahlen speichern können (&quot;18446744073709551615 (264-1) or greater&quot;). Bei mir schmiert das Programm aber schon bei der Eingabe einer Zahl mit 12 Nullen ab. (Die Konsole geht ohne Fehlermeldung einfach zu). Ein manuelles Zuweisen innerhalb des Codes durch<br />
max_c = 1000000000000;<br />
funktioniert einwandfrei. Könnt ihr mir eventuell sagen, was ich falsch mache? Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/320729/anfängerfrage-große-zahlen-mit-cin</link><generator>RSS for Node</generator><lastBuildDate>Thu, 23 Jul 2026 18:38:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/320729.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 09 Oct 2013 16:16:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Anfängerfrage: Große Zahlen mit cin on Wed, 09 Oct 2013 16:16:53 GMT]]></title><description><![CDATA[<p>Hey,</p>
<p>ich arbeite auf Hinweis einiger von euch nun ein C++ Buch durch und stehe hierbei vor einem Problem:</p>
<pre><code>using namespace std;

unsigned long int max_c;

int _tmain(int argc, _TCHAR* argv[])
{

	cin &gt;&gt; max_c;
	cout &lt;&lt; max_c;

	cin.sync();
	cin.get();
	return 0;
}
</code></pre>
<p>Das Problem steckt anscheinend bei cin &gt;&gt; max_c;. Laut der limits.h (<a href="http://www.cplusplus.com/reference/climits/" rel="nofollow">www.cplusplus.com/reference/climits/</a>) sollte dieser Datentyp ja sehr große Zahlen speichern können (&quot;18446744073709551615 (264-1) or greater&quot;). Bei mir schmiert das Programm aber schon bei der Eingabe einer Zahl mit 12 Nullen ab. (Die Konsole geht ohne Fehlermeldung einfach zu). Ein manuelles Zuweisen innerhalb des Codes durch<br />
max_c = 1000000000000;<br />
funktioniert einwandfrei. Könnt ihr mir eventuell sagen, was ich falsch mache? Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359205</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359205</guid><dc:creator><![CDATA[Frolo]]></dc:creator><pubDate>Wed, 09 Oct 2013 16:16:53 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage: Große Zahlen mit cin on Wed, 09 Oct 2013 16:23:50 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/u109509" rel="nofollow">SeppJ</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/f10" rel="nofollow">C (C89, C99 und C11)</a> in das Forum <a href="http://www.c-plusplus.net/forum/f15" rel="nofollow">C++ (auch C++0x und C++11)</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359209</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359209</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Wed, 09 Oct 2013 16:23:50 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage: Große Zahlen mit cin on Wed, 09 Oct 2013 16:30:33 GMT]]></title><description><![CDATA[<p>Frolo schrieb:</p>
<blockquote>
<p>Das Problem steckt anscheinend bei cin &gt;&gt; max_c;. Laut der limits.h (<a href="http://www.cplusplus.com/reference/climits/" rel="nofollow">www.cplusplus.com/reference/climits/</a>) sollte dieser Datentyp ja sehr große Zahlen speichern können (&quot;18446744073709551615 (264-1) or greater&quot;).</p>
</blockquote>
<p>Da hast du schlichtweg falsch geguckt. Mindestmaximum für unsigned long ist 2^32-1. Es wäre auch nicht so ungewöhnlich, das tatsächlich so vor zu finden, denn das ist beispielsweise der Standard in Windowssystemen, auf denen du offensichtlich unterwegs bist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359211</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359211</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 09 Oct 2013 16:30:33 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage: Große Zahlen mit cin on Wed, 09 Oct 2013 16:42:25 GMT]]></title><description><![CDATA[<p>Da dir große Zahlen so wichtig zu sein scheinen sieh dir mal <a href="http://www.ttmath.org/" rel="nofollow">TTmath</a> an.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359213</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359213</guid><dc:creator><![CDATA[nwp3]]></dc:creator><pubDate>Wed, 09 Oct 2013 16:42:25 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage: Große Zahlen mit cin on Wed, 09 Oct 2013 16:44:48 GMT]]></title><description><![CDATA[<blockquote>
<p>(Die Konsole geht ohne Fehlermeldung einfach zu)</p>
</blockquote>
<p>Dann werden noch Zeichen im Buffer liegen. Woher die allerdings kommen, ist mir unklar, denn auch wenn du eine zu große Zahl eingegeben hast, sollten alle Ziffern extrahiert werden.</p>
<blockquote>
<p>Ein manuelles Zuweisen innerhalb des Codes durch<br />
max_c = 1000000000000;<br />
funktioniert einwandfrei.</p>
</blockquote>
<p>Ja, aber der gespeicherte Wert ist nicht der zugewiesene. Prüfe das mal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359214</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359214</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Wed, 09 Oct 2013 16:44:48 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage: Große Zahlen mit cin on Wed, 09 Oct 2013 16:54:15 GMT]]></title><description><![CDATA[<p>nwp3 schrieb:</p>
<blockquote>
<p>Da dir große Zahlen so wichtig zu sein scheinen sieh dir mal <a href="http://www.ttmath.org/" rel="nofollow">TTmath</a> an.</p>
</blockquote>
<p>TTmath? GMP!<br />
<a href="http://www.boost.org/libs/multiprecision/doc/html/index.html" rel="nofollow">www.boost.org/libs/multiprecision/doc/html/index.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359216</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359216</guid><dc:creator><![CDATA[blooast]]></dc:creator><pubDate>Wed, 09 Oct 2013 16:54:15 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage: Große Zahlen mit cin on Wed, 09 Oct 2013 16:56:29 GMT]]></title><description><![CDATA[<p>Arcoth schrieb:</p>
<blockquote>
<blockquote>
<p>(Die Konsole geht ohne Fehlermeldung einfach zu)</p>
</blockquote>
<p>Dann werden noch Zeichen im Buffer liegen. Woher die allerdings kommen, ist mir unklar, denn auch wenn du eine zu große Zahl eingegeben hast, sollten alle Ziffern extrahiert werden.</p>
</blockquote>
<p>Aber der Stream wird in einen Fehlerzustand gesetzt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359217</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359217</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 09 Oct 2013 16:56:29 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage: Große Zahlen mit cin on Wed, 09 Oct 2013 17:03:31 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Arcoth schrieb:</p>
<blockquote>
<blockquote>
<p>(Die Konsole geht ohne Fehlermeldung einfach zu)</p>
</blockquote>
<p>Dann werden noch Zeichen im Buffer liegen. Woher die allerdings kommen, ist mir unklar, denn auch wenn du eine zu große Zahl eingegeben hast, sollten alle Ziffern extrahiert werden.</p>
</blockquote>
<p>Aber der Stream wird in einen Fehlerzustand gesetzt.</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f4a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--light_bulb"
      title=":bulb:"
      alt="💡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359220</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359220</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Wed, 09 Oct 2013 17:03:31 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage: Große Zahlen mit cin on Wed, 09 Oct 2013 17:41:00 GMT]]></title><description><![CDATA[<p>Vielen Dank für eure Antworten! Es gibt den Typ &quot;unsigned long long int&quot;, von dem ich noch nie gehört habe. Dachte leider das &quot;unsigned long int&quot; die größte positive Zahl darstellen kann <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>
<p>Danke ihr habt mir sehr geholfen!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2359225</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2359225</guid><dc:creator><![CDATA[Frolo]]></dc:creator><pubDate>Wed, 09 Oct 2013 17:41:00 GMT</pubDate></item></channel></rss>