<?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[Problem mit einer Schleife]]></title><description><![CDATA[<p>Also ich hab mir heut mal angeschaut wie c++ so n bissl funktioniert und habe dann versucht etwas zu programmieren um Fibonacci-Zahlen zu berechnen<br />
es funktioniert auch so weit, aber wenn man 47 als Zahl eingibt kommt nicht die erwartete Zahl heraus...</p>
<p>Außerdem wollt ich mal wissen, wie ich das Programm nachdem die Lösung rauskommt, wieder eine neue Zahl eingeben kann, also quasie das Programm wiederholen...</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
  using namespace std;

  int main()
  {
      int y=0;
	  int z=1;
	  int e=y;
	  int f=z;
	  int b;
	  int a;
		  cout&lt;&lt;&quot;Gebe eine Zahl ein\n&quot;;
		  cin&gt;&gt;a;
		  if(a&gt;0)
		  {
			  for(int i=0;i&lt;a-1;i=i+1)
			  {
				  b=e+f;
				  e=f;
				  f=b;
			  }
		  }
		  if(a==0)
		  {
			  b=y;
		  }
		  if(a==1)
		  {
			  b=z;
		  }
		  cout&lt;&lt;b&lt;&lt;&quot;\n&quot;;
  }
</code></pre>
<p>Danke für die Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/254544/problem-mit-einer-schleife</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 01:51:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/254544.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 17 Nov 2009 20:33:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit einer Schleife on Tue, 17 Nov 2009 20:33:17 GMT]]></title><description><![CDATA[<p>Also ich hab mir heut mal angeschaut wie c++ so n bissl funktioniert und habe dann versucht etwas zu programmieren um Fibonacci-Zahlen zu berechnen<br />
es funktioniert auch so weit, aber wenn man 47 als Zahl eingibt kommt nicht die erwartete Zahl heraus...</p>
<p>Außerdem wollt ich mal wissen, wie ich das Programm nachdem die Lösung rauskommt, wieder eine neue Zahl eingeben kann, also quasie das Programm wiederholen...</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
  using namespace std;

  int main()
  {
      int y=0;
	  int z=1;
	  int e=y;
	  int f=z;
	  int b;
	  int a;
		  cout&lt;&lt;&quot;Gebe eine Zahl ein\n&quot;;
		  cin&gt;&gt;a;
		  if(a&gt;0)
		  {
			  for(int i=0;i&lt;a-1;i=i+1)
			  {
				  b=e+f;
				  e=f;
				  f=b;
			  }
		  }
		  if(a==0)
		  {
			  b=y;
		  }
		  if(a==1)
		  {
			  b=z;
		  }
		  cout&lt;&lt;b&lt;&lt;&quot;\n&quot;;
  }
</code></pre>
<p>Danke für die Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809592</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809592</guid><dc:creator><![CDATA[moelle92]]></dc:creator><pubDate>Tue, 17 Nov 2009 20:33:17 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit einer Schleife on Tue, 17 Nov 2009 21:17:01 GMT]]></title><description><![CDATA[<p>moelle92 schrieb:</p>
<blockquote>
<p>Außerdem wollt ich mal wissen, wie ich das Programm nachdem die Lösung rauskommt, wieder eine neue Zahl eingeben kann, also quasie das Programm wiederholen...</p>
</blockquote>
<p>Ja, einfach ne while oder do/while Schleife um alles machen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809606</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809606</guid><dc:creator><![CDATA[aaxxaaxxz]]></dc:creator><pubDate>Tue, 17 Nov 2009 21:17:01 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit einer Schleife on Tue, 17 Nov 2009 22:49:44 GMT]]></title><description><![CDATA[<p>hatte ich auch schon versucht, aber als ich es denn ausprobiert hab, ging es gar nicht, sondern es wiederholten sich nur ein paar Zeilen, immer und immer wieder und ziemlich schnell^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809637</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809637</guid><dc:creator><![CDATA[moelle92]]></dc:creator><pubDate>Tue, 17 Nov 2009 22:49:44 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit einer Schleife on Wed, 18 Nov 2009 05:53:21 GMT]]></title><description><![CDATA[<p>Frage komm raus, du bist umzingelt!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809674</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809674</guid><dc:creator><![CDATA[Kóyaánasqatsi]]></dc:creator><pubDate>Wed, 18 Nov 2009 05:53:21 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit einer Schleife on Wed, 18 Nov 2009 08:25:04 GMT]]></title><description><![CDATA[<p>Ich frage mich, wieso es <code>b=e+f</code> heisst. Es muss doch <code>z=f-y</code> heissen. Das geht doch aus dem Code Glasklar hervor.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809712</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809712</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Wed, 18 Nov 2009 08:25:04 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit einer Schleife on Wed, 18 Nov 2009 08:56:26 GMT]]></title><description><![CDATA[<p>moelle92 schrieb:</p>
<blockquote>
<p>es funktioniert auch so weit, aber wenn man 47 als Zahl eingibt kommt nicht die erwartete Zahl heraus...</p>
</blockquote>
<p>Weil das Ergebnis nicht in einen int paßt. Das ist ok so.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809739</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809739</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Wed, 18 Nov 2009 08:56:26 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit einer Schleife on Wed, 18 Nov 2009 13:19:12 GMT]]></title><description><![CDATA[<p>Also des mit dem int hab ich verstanden... Ich habe jetzt statt dem int ein unsigned long drinne. Aber jetzt funktionierts nur bis zu 48 ...<br />
Ist unsigned long auch zu kurz?? gibts da noch andre möglichkeiten?</p>
<p>die Funktion müsste soweit stimmen...<br />
ich hab jetzt auch ein return mit eigebaut innerhalb while/do</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
  using namespace std;

  unsigned long main()
  {
      unsigned long y=0;
	  unsigned long z=1;
	  unsigned long e=y;
	  unsigned long f=z;
	  unsigned long b;
	  unsigned long a;
	  char m;
			  cout&lt;&lt;&quot;Gebe eine Zahl ein\n&quot;;
			  cin&gt;&gt;a;
			  if(a&gt;0)
			  {
				  for(unsigned long i=0;i&lt;a-1;i=i+1)
				  {
					  b=e+f;
					  cout&lt;&lt;b&lt;&lt;&quot;\n&quot;;
					  e=f;
					  f=b;
				  }
			  }
			  if(a==0)
			  {
				  b=y;
			  }
			  if(a==1)
			  {
				  b=z;
			  }
			  cout&lt;&lt;b&lt;&lt;&quot;\n&quot;;
			  cin.clear();
			  cout&lt;&lt;&quot;Nochmal? j/n\n&quot;;
			  cin&gt;&gt;m;
			  if(m=='j')
			  {
				  return main();
			  }
			  else if(m=='n')
			  {
				  return 0;
			  }
  }
</code></pre>
<p>Aber irgendiwe funktioniert es noch nich so ganz mit dem return, bei manchen kommt dann wieder ein anderes Ergebnis raus.<br />
Also wäre ein User so freundlich und könnte mal nen Blick drauf werfen und mir sagen was ich falsch gemacht habe....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809871</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809871</guid><dc:creator><![CDATA[moelle92]]></dc:creator><pubDate>Wed, 18 Nov 2009 13:19:12 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit einer Schleife on Wed, 18 Nov 2009 13:59:13 GMT]]></title><description><![CDATA[<p>moelle92 schrieb:</p>
<blockquote>
<p>Also des mit dem int hab ich verstanden... Ich habe jetzt statt dem int ein unsigned long drinne. Aber jetzt funktionierts nur bis zu 48 ...<br />
Ist unsigned long auch zu kurz?? gibts da noch andre möglichkeiten?</p>
</blockquote>
<p>Wieviele Stellen brauchst Du denn?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809909</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809909</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Wed, 18 Nov 2009 13:59:13 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit einer Schleife on Wed, 18 Nov 2009 15:13:34 GMT]]></title><description><![CDATA[<p>naja theoretisch so viel wies geht...<br />
wie lang gehts denn bei c++ ??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809962</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809962</guid><dc:creator><![CDATA[moelle92]]></dc:creator><pubDate>Wed, 18 Nov 2009 15:13:34 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit einer Schleife on Wed, 18 Nov 2009 15:41:58 GMT]]></title><description><![CDATA[<p>Je nach Compiler könntest du &quot;unsigned long long&quot; bzw. &quot;unsigned __int64&quot; benutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809975</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809975</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Wed, 18 Nov 2009 15:41:58 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit einer Schleife on Wed, 18 Nov 2009 15:48:02 GMT]]></title><description><![CDATA[<p>vielen Dank Th69 ich habs etz mit ner 13-stelligen Zahl versucht und es hat geklappt</p>
<p>ich benutze Visual C++ wie lang sind dann die variablen Th69 maximal?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809976</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809976</guid><dc:creator><![CDATA[moelle92]]></dc:creator><pubDate>Wed, 18 Nov 2009 15:48:02 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit einer Schleife on Wed, 18 Nov 2009 16:22:49 GMT]]></title><description><![CDATA[<p>moelle92 schrieb:</p>
<blockquote>
<p>naja theoretisch so viel wies geht...<br />
wie lang gehts denn bei c++ ??</p>
</blockquote>
<p>C++ selbst hat mit unsignes long long 19 Stellen (je nach Compiler auch weniger, eher nicht mehr). Mit sowas <a href="http://gmplib.org/" rel="nofollow">http://gmplib.org/</a> gehen aber auch Millionen und abermillionen von Stellen. long double hat in der Mantisse auch nur 64 Bit, kann also nicht mehr.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809985</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809985</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Wed, 18 Nov 2009 16:22:49 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit einer Schleife on Wed, 18 Nov 2009 21:53:01 GMT]]></title><description><![CDATA[<p>Also mehr geht mit visual nicht oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1810202</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1810202</guid><dc:creator><![CDATA[moelle92]]></dc:creator><pubDate>Wed, 18 Nov 2009 21:53:01 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit einer Schleife on Wed, 18 Nov 2009 21:58:33 GMT]]></title><description><![CDATA[<p>moelle92 schrieb:</p>
<blockquote>
<p>Also mehr geht mit visual nicht oder?</p>
</blockquote>
<p>Mit eingebauten Typen nicht. Nein. Aber eben mit volkard's Link hast du etwas, was lediglich auf Ressourcen Ebene beschränkt ist. Also wenn es dir da dann noch zu ungenau wird, dann kannst du dir einfach das System aufrüsten und weiter arbeiten. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1810203</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1810203</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Wed, 18 Nov 2009 21:58:33 GMT</pubDate></item></channel></rss>