<?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[Polynomklasse]]></title><description><![CDATA[<p>Hallo,<br />
ich habe folgende Klasse für Polynome vorgegeben und muss jetzt eine Funktion schreiben, die ein Polynom ableitet ( deriv() ) und eine die zwei Polynome miteinander multipliziert ( multiply(const CPolynom&amp;) )</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

class CPolynom
{
private:			
	int degree;
	double * coeff;
public:
	CPolynom(const CPolynom &amp;);
	CPolynom(int d) 
	{
		coeff = new double[d+1]; 
		degree = d;
	};
	virtual ~CPolynom() 
	{
		delete [] coeff;
	};
	int getDegree() const 
	{
		return degree;
	};
	double * getCoeff() const
	{
		return coeff;
	};

	CPolynom deriv() const;                        //NOCH ZU IMPLEMENTIEREN
	CPolynom multiply(const CPolynom&amp; p) const;    //NOCH ZU IMPLEMENTIEREN
};

CPolynom::CPolynom(const CPolynom &amp; p)
{
	degree = p.getDegree();
	coeff = new double[degree+1];
	double * coeff2 = p.getCoeff();
	for(int i=0; i&lt;=degree; i++)
		coeff[i] = coeff2[i];
}
</code></pre>
<p>Wäre nett wenn mir jmd helfen könnte</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/244423/polynomklasse</link><generator>RSS for Node</generator><lastBuildDate>Sat, 19 Sep 2026 10:49:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/244423.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 30 Jun 2009 06:24:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Polynomklasse on Tue, 30 Jun 2009 06:24:57 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich habe folgende Klasse für Polynome vorgegeben und muss jetzt eine Funktion schreiben, die ein Polynom ableitet ( deriv() ) und eine die zwei Polynome miteinander multipliziert ( multiply(const CPolynom&amp;) )</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

class CPolynom
{
private:			
	int degree;
	double * coeff;
public:
	CPolynom(const CPolynom &amp;);
	CPolynom(int d) 
	{
		coeff = new double[d+1]; 
		degree = d;
	};
	virtual ~CPolynom() 
	{
		delete [] coeff;
	};
	int getDegree() const 
	{
		return degree;
	};
	double * getCoeff() const
	{
		return coeff;
	};

	CPolynom deriv() const;                        //NOCH ZU IMPLEMENTIEREN
	CPolynom multiply(const CPolynom&amp; p) const;    //NOCH ZU IMPLEMENTIEREN
};

CPolynom::CPolynom(const CPolynom &amp; p)
{
	degree = p.getDegree();
	coeff = new double[degree+1];
	double * coeff2 = p.getCoeff();
	for(int i=0; i&lt;=degree; i++)
		coeff[i] = coeff2[i];
}
</code></pre>
<p>Wäre nett wenn mir jmd helfen könnte</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1734855</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1734855</guid><dc:creator><![CDATA[sp1nnaker]]></dc:creator><pubDate>Tue, 30 Jun 2009 06:24:57 GMT</pubDate></item><item><title><![CDATA[Reply to Polynomklasse on Tue, 30 Jun 2009 06:28:19 GMT]]></title><description><![CDATA[<p>sp1nnaker schrieb:</p>
<blockquote>
<p>Wäre nett wenn mir jmd helfen könnte</p>
</blockquote>
<p>Klar, kein Problem.</p>
<p>Wenn du eine Frage hast, solltest du sie aber stellen. Wir sind keine Hellseher.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1734856</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1734856</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Tue, 30 Jun 2009 06:28:19 GMT</pubDate></item><item><title><![CDATA[Reply to Polynomklasse on Tue, 30 Jun 2009 06:40:19 GMT]]></title><description><![CDATA[<p>sp1nnaker schrieb:</p>
<blockquote>
<p>Wäre nett wenn mir jmd helfen könnte</p>
</blockquote>
<p>Ok, also das Ableiten und <a href="http://de.wikipedia.org/wiki/Polynom#Polynome_in_der_abstrakten_Algebra" rel="nofollow">Multiplizieren</a> müsstest Du selbst mit ein bischen Nachdenken hinbekommen. Das ist auch eher ein Matheproblem statt C++-Problem.</p>
<p>Und sonst ist mir aufgefallen, dass Du die <a href="http://de.wikipedia.org/wiki/Dreierregel_(C%2B%2B)" rel="nofollow">&quot;Dreierregel&quot;</a> verletzt. Du hast das Überschreiben des Zuweisungsoperators vergessen. Viel besser wär's aber gewesen, wenn Du statt des Zeigers einfach einen <code>std::vector</code> für die Koeffizienten benutzt hättest. Dann bräuchtest Du Dich nämlich gar keinen eigenen Kopier-Konstruktor, Destruktor und Zuweisungsoperator.</p>
<p>Gruß,<br />
SP</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1734860</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1734860</guid><dc:creator><![CDATA[Sebastian Pizer]]></dc:creator><pubDate>Tue, 30 Jun 2009 06:40:19 GMT</pubDate></item><item><title><![CDATA[Reply to Polynomklasse on Tue, 30 Jun 2009 06:42:50 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/36159">@Sebastian</a>: Ich denke dieser Code ist 1:1 so in der Angabe vorgegeben und es geht ihm nun um die Durchführung des Programmierbeispiels durch ein Forenmitglied <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>
<p>Eigentlich sollte das ja an Unis Konsequenzen haben, aber da das ungestraft bleibt versuchen die das munter weiter <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>MfG SideWinder</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1734861</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1734861</guid><dc:creator><![CDATA[SideWinder]]></dc:creator><pubDate>Tue, 30 Jun 2009 06:42:50 GMT</pubDate></item><item><title><![CDATA[Reply to Polynomklasse on Tue, 30 Jun 2009 08:11:47 GMT]]></title><description><![CDATA[<p>Ich würd gern noch ein Zitat aus der <a href="http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.2" rel="nofollow">C++ FAQ</a> bringen:</p>
<p>Jack Klein schrieb:</p>
<blockquote>
<p>If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm.</p>
</blockquote>
<p>Gruß,<br />
SP</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1734895</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1734895</guid><dc:creator><![CDATA[Sebastian Pizer]]></dc:creator><pubDate>Tue, 30 Jun 2009 08:11:47 GMT</pubDate></item><item><title><![CDATA[Reply to Polynomklasse on Tue, 30 Jun 2009 08:24:43 GMT]]></title><description><![CDATA[<p>Sebastian Pizer schrieb:</p>
<blockquote>
<p>...</p>
<p>Jack Klein schrieb:</p>
<blockquote>
<p>If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm.</p>
</blockquote>
<p>...</p>
</blockquote>
<p>Ich befürchte nur, dass da zuviele &quot;mights&quot; drin sind, um Schnorrer wirklich abzuschrecken.</p>
<p>... ganz zu schweigen vom impliziten &quot;might&quot; am Ende:</p>
<p>Jack Klein schrieb:</p>
<blockquote>
<p>...<br />
Someday you might work on a project with me without knowing how to write a program like this <strong>as my boss (because of your ability to disguise your lack of any skill with the work of others)</strong>. Then I would <strong>suffer</strong> serious <strong>mental</strong> harm - what you will ignore completely.</p>
</blockquote>
<p>...</p>
<p>Gruß,</p>
<p>Simon2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1734905</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1734905</guid><dc:creator><![CDATA[Simon2]]></dc:creator><pubDate>Tue, 30 Jun 2009 08:24:43 GMT</pubDate></item><item><title><![CDATA[Reply to Polynomklasse on Tue, 30 Jun 2009 08:54:11 GMT]]></title><description><![CDATA[<p>Also, mein Problem liegt nicht in der Mathematik sondern mehr in C++:</p>
<p>Ich würde theoretisch das Polynom in ein neues Polynom kopieren, dieses ableiten und dann zurückgeben, leider weiß ich nicht wie ich das machen soll.</p>
<p>Der Algorithmus selbst ist ja recht einfach:</p>
<pre><code class="language-cpp">for(int i=0; i&lt;degree; i++)
	{
		coeff[i] = coeff[i+1] * (i+1);
	}
	degree--;
</code></pre>
<p>Ist übrigens keine Hausaufgabe, sondern nur für mich zum Verständnis</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1734925</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1734925</guid><dc:creator><![CDATA[sp1nnaker]]></dc:creator><pubDate>Tue, 30 Jun 2009 08:54:11 GMT</pubDate></item><item><title><![CDATA[Reply to Polynomklasse on Tue, 30 Jun 2009 11:21:51 GMT]]></title><description><![CDATA[<p>Bring doch erstmal Deine Klasse in Ordnung.<br />
- mach den Konstruktor mit dem <code>int d</code> -Parameter explizit.<br />
- Ein <code>virtual</code> Destruktor ist hier unnötig.<br />
- Definiere einen eigenen Zuweisungoperator <em>oder</em> verwende einfach einen <code>std::vector&lt;double&gt;</code> statt <code>double*</code> und <code>int</code> als Objektelemente. Dann könntest Du Dir nämlich alle <a href="http://de.wikipedia.org/wiki/Dreierregel_(C%2B%2B)" rel="nofollow">drei</a> Funktionen sparen.</p>
<p>Letzteres ist ein dicker Fehler, der dazu führen kann, dass Dein Programm sich komisch verhält oder sogar abstürzt.</p>
<blockquote>
<p>Ich würde theoretisch das Polynom in ein neues Polynom kopieren, dieses ableiten und dann zurückgeben,</p>
</blockquote>
<p>Dann mach das doch. Wo liegt denn da das Problem? Du musst da schon n bissel mehr schreiben als &quot;leider weiß ich nicht wie ich das machen soll&quot;.</p>
<p>Gruß,<br />
SP</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1734982</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1734982</guid><dc:creator><![CDATA[Sebastian Pizer]]></dc:creator><pubDate>Tue, 30 Jun 2009 11:21:51 GMT</pubDate></item></channel></rss>