<?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[Werte aus einer Funktion benutzen ?]]></title><description><![CDATA[<p>Ich möchte gerne in einer Funktion 2 Werte einlesen lassen,allerdings brauch ich die werte nach der Funktion noch. Wie kann ich die Werte &quot;aus der Funktion bringen&quot; ?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/185357/werte-aus-einer-funktion-benutzen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 03:06:45 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/185357.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 24 Jun 2007 16:26:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Werte aus einer Funktion benutzen ? on Sun, 24 Jun 2007 16:26:58 GMT]]></title><description><![CDATA[<p>Ich möchte gerne in einer Funktion 2 Werte einlesen lassen,allerdings brauch ich die werte nach der Funktion noch. Wie kann ich die Werte &quot;aus der Funktion bringen&quot; ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312861</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312861</guid><dc:creator><![CDATA[Summernoon]]></dc:creator><pubDate>Sun, 24 Jun 2007 16:26:58 GMT</pubDate></item><item><title><![CDATA[Reply to Werte aus einer Funktion benutzen ? on Sun, 24 Jun 2007 16:43:54 GMT]]></title><description><![CDATA[<p>Summernoon schrieb:</p>
<blockquote>
<p>Ich möchte gerne in einer Funktion 2 Werte einlesen lassen,allerdings brauch ich die werte nach der Funktion noch. Wie kann ich die Werte &quot;aus der Funktion bringen&quot; ?</p>
</blockquote>
<p>Der Ansatz ist falsch. Lies die Werte außerhalb (vor dem Aufruf der Funktion) ein und übergib sie der Funktion als Parameter.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1312875</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1312875</guid><dc:creator><![CDATA[Konrad Rudolph]]></dc:creator><pubDate>Sun, 24 Jun 2007 16:43:54 GMT</pubDate></item><item><title><![CDATA[Reply to Werte aus einer Funktion benutzen ? on Sun, 24 Jun 2007 21:11:49 GMT]]></title><description><![CDATA[<p>passt leider nicht ins konzept.<br />
Ich will die Eingabe z.b.</p>
<pre><code class="language-cpp">std::cout &lt;&lt; &quot;zahl1:&quot; &lt;&lt; std::flsuh;
double zahl1 = 0.0;
std::cin &gt;&gt; zahl1;

std::cout &lt;&lt; &quot;zahl2&quot; &lt;&lt; std::flsuh;
double zahl2 = 0.0;
std::cin &gt;&gt; zahl2;
</code></pre>
<p>ich will das nur einmal schreiben aber immer wieder i-wo einbinden und die Werte benutzen können.<br />
Wie geht sowas ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1313010</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1313010</guid><dc:creator><![CDATA[Summernoon]]></dc:creator><pubDate>Sun, 24 Jun 2007 21:11:49 GMT</pubDate></item><item><title><![CDATA[Reply to Werte aus einer Funktion benutzen ? on Sun, 24 Jun 2007 21:19:25 GMT]]></title><description><![CDATA[<p>Du übergibst der Funktion die später benötigten Variablen als <strong>Referenzparameter</strong>, ließt sie dann in der Funktion ein und kannst sie dann später weiter verwenden.</p>
<p>MfG<br />
Hundefutter</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1313013</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1313013</guid><dc:creator><![CDATA[Hundefutter]]></dc:creator><pubDate>Sun, 24 Jun 2007 21:19:25 GMT</pubDate></item><item><title><![CDATA[Reply to Werte aus einer Funktion benutzen ? on Mon, 25 Jun 2007 02:37:34 GMT]]></title><description><![CDATA[<p>Hya ! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f576.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--sunglasses"
      title=":sunglasses:"
      alt="🕶"
    /></p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;limits&gt;
using namespace std;

void einmal_geschrieben( double &amp;z1, double &amp;z2 )
{
	cout &lt;&lt; &quot;Bitte geben sie Zahl 1 ein: &quot;;
	while(!(cin&gt;&gt;z1))
	{
		cin.clear();
		cin.ignore(numeric_limits&lt;streamsize&gt;::max(),'\n'); 
		cout&lt;&lt;&quot;\nPfui! Bitte geben sie Zahl 1 ein: &quot;;
	}

	cout &lt;&lt; &quot;Bitte geben sie Zahl 2 ein: &quot;;
	while(!(cin&gt;&gt;z2))
	{
		cin.clear();
		cin.ignore(numeric_limits&lt;streamsize&gt;::max(),'\n'); 
		cout&lt;&lt;&quot;\nPfui! Bitte geben sie Zahl 2 ein: &quot;;
	}
}

void dort_verwendet( double &amp;z1, double &amp;z2 )
{
	einmal_geschrieben( z1, z2 );
}

int main()
{
	double zahl1, zahl2, zahl3, zahl4;

	einmal_geschrieben( zahl1, zahl2 );
	dort_verwendet    ( zahl3, zahl4 );

	return 0;
}
</code></pre>
<p><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>
]]></description><link>https://www.c-plusplus.net/forum/post/1313060</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1313060</guid><dc:creator><![CDATA[proggingm@nia]]></dc:creator><pubDate>Mon, 25 Jun 2007 02:37:34 GMT</pubDate></item><item><title><![CDATA[Reply to Werte aus einer Funktion benutzen ? on Mon, 25 Jun 2007 04:01:27 GMT]]></title><description><![CDATA[<blockquote>
<p>passt leider nicht ins konzept.<br />
Ich will die Eingabe z.b.</p>
<p>C/C++ Code:<br />
std::cout &lt;&lt; &quot;zahl1:&quot; &lt;&lt; std::flsuh;<br />
double zahl1 = 0.0;<br />
std::cin &gt;&gt; zahl1;</p>
<p>std::cout &lt;&lt; &quot;zahl2&quot; &lt;&lt; std::flsuh;<br />
double zahl2 = 0.0;<br />
std::cin &gt;&gt; zahl2;<br />
C/C++ Code:<br />
std::cout &lt;&lt; &quot;zahl1:&quot; &lt;&lt; std::flsuh;<br />
double zahl1 = 0.0;<br />
std::cin &gt;&gt; zahl1;</p>
<p>std::cout &lt;&lt; &quot;zahl2&quot; &lt;&lt; std::flsuh;<br />
double zahl2 = 0.0;<br />
std::cin &gt;&gt; zahl2;<br />
C/C++ Code:<br />
std::cout &lt;&lt; &quot;zahl1:&quot; &lt;&lt; std::flsuh;<br />
double zahl1 = 0.0;<br />
std::cin &gt;&gt; zahl1;</p>
<p>std::cout &lt;&lt; &quot;zahl2&quot; &lt;&lt; std::flsuh;<br />
double zahl2 = 0.0;<br />
std::cin &gt;&gt; zahl2;</p>
<p><strong>ich will das nur einmal schreiben aber immer wieder i-wo einbinden und die Werte benutzen können.</strong><br />
Wie geht sowas ?</p>
</blockquote>
<p>Vll. wollter auch so ne funktion:</p>
<pre><code class="language-cpp">void einmal_geschrieben(int Zahl, double &amp;z)
{
    cout &lt;&lt; &quot;Bitte geben sie Zahl&quot; &lt;&lt; Zahl &lt;&lt; &quot; ein: &quot;;
    while(!(cin&gt;&gt;z))
    {
        cin.clear();
        cin.ignore(numeric_limits&lt;streamsize&gt;::max(),'\n'); 
        cout&lt;&lt;&quot;\nPfui! Bitte geben sie Zahl &lt;&lt; Zahl &lt;&lt; &quot; ein: &quot;;
    }

}
</code></pre>
<p>benutzen irgendwo?</p>
<pre><code class="language-cpp">int a,b,c,d,e;

einmal_geschrieben(1,a);
einmal_geschrieben(2,b);
einmal_geschrieben(3,c);
einmal_geschrieben(4,d);
einmal_geschrieben(5,e);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1313064</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1313064</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Mon, 25 Jun 2007 04:01:27 GMT</pubDate></item></channel></rss>