<?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[Fragen zur Funktion sqrt]]></title><description><![CDATA[<p>Kann man mit der Funktion sqrt auch mehrere Zahlen ausgeben??</p>
<p>z.B von 1 bis 144</p>
<p>danke für die hilfeee</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/247887/fragen-zur-funktion-sqrt</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 10:30:51 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/247887.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 17 Aug 2009 08:20:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fragen zur Funktion sqrt on Mon, 17 Aug 2009 08:20:02 GMT]]></title><description><![CDATA[<p>Kann man mit der Funktion sqrt auch mehrere Zahlen ausgeben??</p>
<p>z.B von 1 bis 144</p>
<p>danke für die hilfeee</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1762105</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1762105</guid><dc:creator><![CDATA[whaaatz]]></dc:creator><pubDate>Mon, 17 Aug 2009 08:20:02 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zur Funktion sqrt on Mon, 17 Aug 2009 08:21:43 GMT]]></title><description><![CDATA[<p>sqrt() gibt was aus?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1762108</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1762108</guid><dc:creator><![CDATA[Sqrt0r]]></dc:creator><pubDate>Mon, 17 Aug 2009 08:21:43 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zur Funktion sqrt on Mon, 17 Aug 2009 08:25:08 GMT]]></title><description><![CDATA[<p>ich meine nicht mit sqrt() ausgeben....<br />
aber ich habe bis jetzt nur gesehen das man mit der Funktion sqrt() immer nur eine Zahl berechnen kann...</p>
<p>und ich würde gerne wissen ob es geht das ich alle Quadratzahlen von 1 bis 144 ausgeben kann auf einmal?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1762109</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1762109</guid><dc:creator><![CDATA[whaaatz]]></dc:creator><pubDate>Mon, 17 Aug 2009 08:25:08 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zur Funktion sqrt on Mon, 17 Aug 2009 08:28:23 GMT]]></title><description><![CDATA[<p>mit for ?</p>
<pre><code class="language-cpp">for( double x=1; x&lt;=144; x+=1.0 ) {
        cout &lt;&lt; &quot;sqrt(&quot; &lt;&lt; x &lt;&lt; &quot;)= &quot; &lt;&lt; sqrt(x) &lt;&lt; endl;
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1762112</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1762112</guid><dc:creator><![CDATA[sjdlcuskajdnca]]></dc:creator><pubDate>Mon, 17 Aug 2009 08:28:23 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zur Funktion sqrt on Mon, 17 Aug 2009 08:32:50 GMT]]></title><description><![CDATA[<p>whaaatz schrieb:</p>
<blockquote>
<p>und ich würde gerne wissen ob es geht das ich alle Quadratzahlen von 1 bis 144 ausgeben kann auf einmal?</p>
</blockquote>
<p>Nein, auf einmal garantiert nicht, nicht mit nur einem Aufruf.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1762117</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1762117</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Mon, 17 Aug 2009 08:32:50 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zur Funktion sqrt on Mon, 17 Aug 2009 09:05:20 GMT]]></title><description><![CDATA[<p>sjdlcuskajdnca schrieb:</p>
<blockquote>
<p>mit for ?</p>
<pre><code class="language-cpp">for( double x=1; x&lt;=144; x+=1.0 ) {
        cout &lt;&lt; &quot;sqrt(&quot; &lt;&lt; x &lt;&lt; &quot;)= &quot; &lt;&lt; sqrt(x) &lt;&lt; endl;
    }
</code></pre>
</blockquote>
<p>Das hatte ich auch schon... aber meine vorstellung ist das ich als ausgabe 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, dies habe...</p>
<p>aber ich denke es geht gar nicht :S</p>
<p>Danke das du dir zeit genommen hast</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1762132</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1762132</guid><dc:creator><![CDATA[whaaatz]]></dc:creator><pubDate>Mon, 17 Aug 2009 09:05:20 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zur Funktion sqrt on Mon, 17 Aug 2009 09:06:33 GMT]]></title><description><![CDATA[<p>whaaatz schrieb:</p>
<blockquote>
<p>ich meine nicht mit sqrt() ausgeben....<br />
aber ich habe bis jetzt nur gesehen das man mit der Funktion sqrt() immer nur eine Zahl berechnen kann...</p>
<p>und ich würde gerne wissen ob es geht das ich alle Quadratzahlen von 1 bis 144 ausgeben kann auf einmal?</p>
</blockquote>
<p>Also mit sqrt kannst Du gar nichts ausgeben. Und Quadratzahlen lassen sich mit sqrt erst recht nicht berechnen. Eher doch die Wurzel. Und zwar immer nur eine auf einmal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1762134</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1762134</guid><dc:creator><![CDATA[tntnet]]></dc:creator><pubDate>Mon, 17 Aug 2009 09:06:33 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zur Funktion sqrt on Mon, 17 Aug 2009 09:31:45 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/22179">@whaaatz</a>,<br />
Und wieso der Umweg über <code>sqrt</code> , also der Quadratwurzel?</p>
<pre><code class="language-cpp">for(int i = 0; i &lt; 13; ++i)
{
  std::cout &lt;&lt; (i * i) &lt;&lt; ' ';
}

std::cout.flush();
</code></pre>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1762149</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1762149</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Mon, 17 Aug 2009 09:31:45 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zur Funktion sqrt on Mon, 17 Aug 2009 09:41:22 GMT]]></title><description><![CDATA[<p>Na, wenn's dich so freut, eine Funktion mit beliebiger Parameterzahl zu haben:</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
#include&lt;cstdarg&gt;

void my_sqr(int n, ...)   // Erster Parameter: Anzahl der zu quadrierenden Zahlen
						  // Danach die zu quadrierenden Zahlen
{
   int t;
   va_list ap;
   va_start(ap,n);
   for(int i=0;i &lt; n; i++)
   {
     t=va_arg(ap,int);
     std::cout&lt;&lt; t*t;
	 if (i&lt;(n-1)) std::cout &lt;&lt; &quot;, &quot;;
   }
   std::cout &lt;&lt; std::endl;
   va_end(ap);
}

int main(){
	my_sqr(1,3);                // 9
	my_sqr(5, 1, 2, 3, 4, 5);   // 1, 4, 9, 16, 25
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1762154</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1762154</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 17 Aug 2009 09:41:22 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zur Funktion sqrt on Mon, 17 Aug 2009 09:54:25 GMT]]></title><description><![CDATA[<p>whaaatz schrieb:</p>
<blockquote>
<p>meine vorstellung ist das ich als ausgabe 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, dies habe...</p>
<p>aber ich denke es geht gar nicht</p>
</blockquote>
<p>und was ist mit <a href="http://www.c-plusplus.net/forum/viewtopic-var-p-is-1760721.html#1760721" rel="nofollow">Deinem letzten Thread hier</a> ??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1762166</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1762166</guid><dc:creator><![CDATA[sjdlcuskajdnca]]></dc:creator><pubDate>Mon, 17 Aug 2009 09:54:25 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zur Funktion sqrt on Mon, 17 Aug 2009 10:02:53 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Na, wenn's dich so freut, eine Funktion mit beliebiger Parameterzahl zu haben:</p>
<pre><code class="language-cpp">void my_sqr(int n, ...)   // Erster Parameter: Anzahl der zu quadrierenden Zahlen
						  // Danach die zu quadrierenden Zahlen
</code></pre>
</blockquote>
<p>Also wenn schon, dann schon den C++-Weg - oder!?:</p>
<pre><code class="language-cpp">#include &lt;algorithm&gt;
#include &lt;iostream&gt;
#include &lt;iterator&gt;

struct QuadratIterator : std::iterator&lt; std::input_iterator_tag, int &gt;
{
    explicit QuadratIterator( int root = 1 ) : m_val(root*root), m_delta(2*root+1) {}
    int operator*() const { return m_val; }
    QuadratIterator&amp; operator++()
    {
        m_val += m_delta;
        m_delta += 2;
        return *this;
    }
    bool operator!=( const QuadratIterator&amp; b ) const
    {
        return m_val != b.m_val;
    }
private:
    int m_val, m_delta;
};

int main()
{
    using namespace std;
    // gibt: 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, aus
    copy( QuadratIterator(), QuadratIterator(13), ostream_iterator&lt; int &gt;( cout, &quot;, &quot; ) );
    cout &lt;&lt; endl;
    return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1762175</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1762175</guid><dc:creator><![CDATA[Werner_logoff]]></dc:creator><pubDate>Mon, 17 Aug 2009 10:02:53 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zur Funktion sqrt on Mon, 17 Aug 2009 11:05:16 GMT]]></title><description><![CDATA[<p>Werner_logoff schrieb:</p>
<blockquote>
<p>Also wenn schon, dann schon den C++-Weg - oder!?:</p>
</blockquote>
<p>Ja, ich hätte ja auch die C++ Variante genommen, aber der Threadersteller hat ja ausdrücklich nach variabler Parameterzahl gefragt und moniert, dass das nicht ginge. Das konnte ich so nicht stehen lassen.</p>
<p>Aber noch eine allgemeine Warnung an alle die mein Programmbeispiel gelesen haben: Funktionen mit variabler Parameterzahl sind fehleranfällig und können in C++ leicht durch bessere Sprachmittel ersetzt werden. Siehe Werner_logoffs Beitrag für ein Beispiel dazu.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1762215</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1762215</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 17 Aug 2009 11:05:16 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zur Funktion sqrt on Mon, 17 Aug 2009 11:17:43 GMT]]></title><description><![CDATA[<p>Werner_logoff schrieb:</p>
<blockquote>
<p>Also wenn schon, dann schon den C++-Weg - oder!?:</p>
</blockquote>
<p>Ich halte das zwar eigentlich für einen schlechten Witz, aber leider weiß ich, dass du das ernst meinst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1762226</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1762226</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Mon, 17 Aug 2009 11:17:43 GMT</pubDate></item></channel></rss>