<?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[quadratische Gleichung was ist hier falsch bitte?]]></title><description><![CDATA[<p>ich muss ein program schreiben aber es klappt nich so wie ich geschrieben habe<br />
kann jemand sage wo stehn meine fehlern,es gibt bestimmt nicht nur eine<br />
ich habe noch nicht den operator if gelent und kann ich nicht verwenden</p>
<pre><code class="language-cpp">#include &lt;cmath&gt;
#include &lt;iostream&gt;

using namespace std;

int main(int argc, char *argv[])
{

    double p,q,x1,x2,d;//x^2 + px + q  d = diskriminante;
    cout &lt;&lt; &quot;p: &quot;;
    cin &gt;&gt; p;
    cout&lt;&lt; &quot;q: &quot;;
    cin &gt;&gt; q;
     double D=(pow(p/2,2)-q)&gt;0 ? (-p/2)+d :(-p/2)-d ;

     cout &lt;&lt; &quot;X1&quot; &lt;&lt; ( D&lt;0 ? &quot;  &quot; : &quot; &quot; ) &lt;&lt; (-p/2)+d
       &lt;&lt; ( D&lt;0? 'i' : ' ' ) &lt;&lt; endl; 

       cout &lt;&lt;   (D==0? &quot;&quot;: &quot;&quot;) &lt;&lt;  (p/2)+d
         &lt;&lt; (D==0 ? '.':'.') &lt;&lt; endl;

         cout &lt;&lt; &quot;Diskriminante = &quot; &lt;&lt; D &lt;&lt;  (pow(p/2,2)-q)  ; 
         x1 =(-p/2)+d ; 
         x2 = (-p/2)-d; 
        cout &lt;&lt; &quot;\n=&gt; Loesungsmenge = { &quot; &lt;&lt; x1 &lt;&lt; &quot;; &quot; &lt;&lt; x2 &lt;&lt; &quot; }&quot;;
    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
<p>wäre sehr dankbar für jede hilfe</p>
<p>mfg<br />
anddy</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/133069/quadratische-gleichung-was-ist-hier-falsch-bitte</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 19:04:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/133069.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 15 Jan 2006 10:44:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Sun, 15 Jan 2006 10:44:30 GMT]]></title><description><![CDATA[<p>ich muss ein program schreiben aber es klappt nich so wie ich geschrieben habe<br />
kann jemand sage wo stehn meine fehlern,es gibt bestimmt nicht nur eine<br />
ich habe noch nicht den operator if gelent und kann ich nicht verwenden</p>
<pre><code class="language-cpp">#include &lt;cmath&gt;
#include &lt;iostream&gt;

using namespace std;

int main(int argc, char *argv[])
{

    double p,q,x1,x2,d;//x^2 + px + q  d = diskriminante;
    cout &lt;&lt; &quot;p: &quot;;
    cin &gt;&gt; p;
    cout&lt;&lt; &quot;q: &quot;;
    cin &gt;&gt; q;
     double D=(pow(p/2,2)-q)&gt;0 ? (-p/2)+d :(-p/2)-d ;

     cout &lt;&lt; &quot;X1&quot; &lt;&lt; ( D&lt;0 ? &quot;  &quot; : &quot; &quot; ) &lt;&lt; (-p/2)+d
       &lt;&lt; ( D&lt;0? 'i' : ' ' ) &lt;&lt; endl; 

       cout &lt;&lt;   (D==0? &quot;&quot;: &quot;&quot;) &lt;&lt;  (p/2)+d
         &lt;&lt; (D==0 ? '.':'.') &lt;&lt; endl;

         cout &lt;&lt; &quot;Diskriminante = &quot; &lt;&lt; D &lt;&lt;  (pow(p/2,2)-q)  ; 
         x1 =(-p/2)+d ; 
         x2 = (-p/2)-d; 
        cout &lt;&lt; &quot;\n=&gt; Loesungsmenge = { &quot; &lt;&lt; x1 &lt;&lt; &quot;; &quot; &lt;&lt; x2 &lt;&lt; &quot; }&quot;;
    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
<p>wäre sehr dankbar für jede hilfe</p>
<p>mfg<br />
anddy</p>
]]></description><link>https://www.c-plusplus.net/forum/post/966896</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/966896</guid><dc:creator><![CDATA[anddy007]]></dc:creator><pubDate>Sun, 15 Jan 2006 10:44:30 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Sun, 15 Jan 2006 11:13:32 GMT]]></title><description><![CDATA[<p>kann jemand mir helfen??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/966922</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/966922</guid><dc:creator><![CDATA[anddy007]]></dc:creator><pubDate>Sun, 15 Jan 2006 11:13:32 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Sun, 15 Jan 2006 11:16:07 GMT]]></title><description><![CDATA[<p>anddy007 schrieb:</p>
<blockquote>
<p>kann jemand mir helfen??</p>
</blockquote>
<p>Was soll den dein Programm machen?</p>
<p>mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/966925</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/966925</guid><dc:creator><![CDATA[joomoo]]></dc:creator><pubDate>Sun, 15 Jan 2006 11:16:07 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Sun, 15 Jan 2006 11:19:11 GMT]]></title><description><![CDATA[<p>anddy007 schrieb:</p>
<blockquote>
<pre><code class="language-cpp">double D=(pow(p/2,2)-q)&gt;0 ? (-p/2)+d :(-p/2)-d ;
</code></pre>
</blockquote>
<p>Hallo Anddy</p>
<p>an dieser Stelle liest Du aus der uninitialisierten Variable 'd'. 'd' und 'D' sind zwei verschiedene Variablen, da C++ case-sensitive ist - also zwischen Klein- und Groß-Schreibung unterscheidet.</p>
<p>Der Ausdruck für das Ziehen einer Wurzel (z.B. aus double x) heißt sqrt( x ).</p>
<p>Versuche zunächst alle benötigten Variablen also D und x1 und x2 zu berechnen und verfahre dann in Abhängigkeit ihrer Werte. Und es reicht auch hin sie genau einmal zu berechnet; das macht das Programm nicht nur schneller (spielt hier wirklich keine Rolle) sondern auch übersichtlicher.</p>
<p>Gruß<br />
Werner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/966928</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/966928</guid><dc:creator><![CDATA[Werner Salomon]]></dc:creator><pubDate>Sun, 15 Jan 2006 11:19:11 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Sun, 15 Jan 2006 11:26:49 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/6950">@joomoo</a> so lautet die aufgabe:</p>
<pre><code class="language-cpp">Für eine quadratische Gleichung der Form  lautet die Lösungsformel . Die Diskriminante D errechnet sich nach der Formel .

Die Lösungen der quadratischen Gleichung hängen von D wie folgt ab:

 :  und  sind reell und verschieden,
 :  und  sind reell und gleich,
 :  und  sind konjugiert-komplex.

Schreiben Sie ein Programm, welches die Werte von p und q in gleichnamige Variablen des Typs double einliest und alle Lösungen, auch die konjugiert-komplexen, ausgibt. Kennzeichnen Sie eine komplexe Zahl in der Ausgabe durch ein nachgestelltes »i«.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/966934</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/966934</guid><dc:creator><![CDATA[anddy007]]></dc:creator><pubDate>Sun, 15 Jan 2006 11:26:49 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Sun, 15 Jan 2006 11:31:19 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/7393">@Werner</a> Salomon<br />
ja d und D sind uterschidlich aber wenn ich 'd' schreibe das program zegt fehler<br />
double instalirung von var `d`deshalb habe ich verändert<br />
aber das prog ist falsch wel zeigt nicht die richtige werte<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/966939</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/966939</guid><dc:creator><![CDATA[anddy007]]></dc:creator><pubDate>Sun, 15 Jan 2006 11:31:19 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Sun, 15 Jan 2006 11:44:12 GMT]]></title><description><![CDATA[<p>Wenn d die Diskriminante sein soll, dann musst Du sie auch berechnen:</p>
<pre><code class="language-cpp">d = pow(p/2,2)-q;
</code></pre>
<p>Erst danach kannst Du Deine Variable D berechnen.<br />
Mir ist aber nicht klar, wass Du mit D bezwecken willst. Wenn d &lt; 0, dann hast Du keine Nullstellen, wenn d = 0, dann hast Du eine Nullstelle, wenn d &gt; 0, dann hast Du zwei Nullstellen (-p/2 +/- sqrt(d)).<br />
siehe z.B. <a href="http://de.wikipedia.org/wiki/Pq-Formel" rel="nofollow">http://de.wikipedia.org/wiki/Pq-Formel</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/966952</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/966952</guid><dc:creator><![CDATA[niemand]]></dc:creator><pubDate>Sun, 15 Jan 2006 11:44:12 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Sun, 15 Jan 2006 12:15:57 GMT]]></title><description><![CDATA[<p>anddy007 schrieb:</p>
<blockquote>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/7393">@Werner</a> Salomon<br />
ja d und D sind uterschidlich aber wenn ich 'd' schreibe das program zegt fehler<br />
double instalirung von var `d`deshalb habe ich verändert<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
</blockquote>
<p>.. aber das ist doch keine Lösung <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /> - was soll 'd' den sein? und was willst Du mit</p>
<p>anddy007 schrieb:</p>
<blockquote>
<pre><code class="language-cpp">double D=(pow(p/2,2)-q)&gt;0 ? (-p/2)+d :(-p/2)-d ;
</code></pre>
</blockquote>
<p>bezwecken?</p>
<p>Gruß<br />
Werner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/966974</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/966974</guid><dc:creator><![CDATA[Werner Salomon]]></dc:creator><pubDate>Sun, 15 Jan 2006 12:15:57 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Sun, 15 Jan 2006 12:23:34 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;cmath&gt;
#include &lt;iostream&gt;

using namespace std;

int main(int argc, char *argv[])
{/*sowei bin ich aber ich weiß nicht was ich schreiben muss damit ich den 
determinane werte rechnet 
D&lt;0,D=0,D&gt;0 */

    double p,q,x1,x2,d;//x^2 + px + q  d = diskriminante;
    cout &lt;&lt; &quot;p: &quot;;
    cin &gt;&gt; p;
    cout&lt;&lt; &quot;q: &quot;;
    cin &gt;&gt; q;
    double D=(pow(p/2,2)-q)&gt;0 ? -p/2 + sqrt((p/2)*(p/2) - q)  : -p/2 - sqrt((p/2)*(p/2) - q) ;

    cout&lt;&lt; &quot;x1: &quot; &lt;&lt;&quot;=&quot; &lt;&lt; -p/2 + sqrt((p/2)*(p/2) - q)&lt;&lt; endl; 
    cout&lt;&lt;  &quot;x2: &quot; &lt;&lt;&quot;=&quot; &lt;&lt; -p/2 - sqrt((p/2)*(p/2) - q)&lt;&lt;endl; 

    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/966979</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/966979</guid><dc:creator><![CDATA[anddy007]]></dc:creator><pubDate>Sun, 15 Jan 2006 12:23:34 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Sun, 15 Jan 2006 14:11:25 GMT]]></title><description><![CDATA[<p>Hallo Anddy,</p>
<p>Das Einlesen von 'p' und 'q' war ja Ok</p>
<pre><code class="language-cpp">#include &lt;cmath&gt;
#include &lt;iostream&gt;

using namespace std;

int main()
{  
    double p,q; //x^2 + px + q
    cout &lt;&lt; &quot;p: &quot;;
    cin &gt;&gt; p;
    cout&lt;&lt; &quot;q: &quot;;
    cin &gt;&gt; q;
</code></pre>
<p>Die Parameter (int argc, char *argv[]) kannst Du weglassen, da Du sie nicht benötigst. Als nächstes bestimmst Du die Diskriminante</p>
<pre><code class="language-cpp">double D = (p/2)*(p/2) - q;
</code></pre>
<p>und nichts anderes. Dann ist natürlich zu überprüfen, ob dieser Wert &gt;0, ==0 oder &lt;0 ist.<br />
Du schreibst, dass Du kein if benutzen kannst - solltest Du hier aber tun:</p>
<pre><code class="language-cpp">if( D &gt; 0.0 )   // wenn der Wert von D größer als 0 ist
    {
        // dann ...
        cout&lt;&lt; &quot;x1: = &quot; &lt;&lt; p/2 + sqrt(D) &lt;&lt; endl;   // wert für 1.
        cout&lt;&lt; &quot;x2: = &quot; &lt;&lt; p/2 - sqrt(D) &lt;&lt; endl;   //    und 2. Lösung ausgeben
    }
</code></pre>
<p>lt. Deiner Aufgabenstellung sollst Du auch die anderen Fälle abdecken. In C++ geht es dann so weiter</p>
<pre><code class="language-cpp">else if( D == 0.0 )
    {
        cout&lt;&lt; &quot;x2: = &quot; &lt;&lt; p/2 &lt;&lt; endl;
    }
    else  // hier kann D nur kleiner als 0 sein
    {
        cout&lt;&lt; &quot;x1: = &quot; &lt;&lt; p/2 &lt;&lt; &quot; + i * &quot; &lt;&lt; sqrt(-D) &lt;&lt; endl;
        cout&lt;&lt; &quot;x2: = &quot; &lt;&lt; p/2 &lt;&lt; &quot; - i * &quot; &lt;&lt; sqrt(-D) &lt;&lt; endl;
    }

    system(&quot;PAUSE&quot;);
    return 0;       // 0 ist ok
}
</code></pre>
<p>Gruß<br />
Werner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/967063</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/967063</guid><dc:creator><![CDATA[Werner Salomon]]></dc:creator><pubDate>Sun, 15 Jan 2006 14:11:25 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Sun, 15 Jan 2006 19:07:35 GMT]]></title><description><![CDATA[<p>danke aber ich habe den if operator noch nicht gelernt<br />
deshalb waollte ich mit<br />
auswahloperator oder( Fragezeichenoperator, ternärer Operator oder Bedingungsoperator) diese aufgabe lösen<br />
mfg<br />
anndy</p>
]]></description><link>https://www.c-plusplus.net/forum/post/967426</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/967426</guid><dc:creator><![CDATA[anddy007]]></dc:creator><pubDate>Sun, 15 Jan 2006 19:07:35 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Mon, 16 Jan 2006 09:22:56 GMT]]></title><description><![CDATA[<p>if() ist kein Operator <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="😉"
    /> (und wo lernst du denn, daß solche Bonus-Eigenschaften wie ?: eher durchgenommen werden als die Programmier-Grundlagen (if oder Schleifen)?)</p>
<p>*versucht, das if()-Beispiel in ein ?: umzuwandeln*</p>
<pre><code class="language-cpp">cout&lt;&lt; (D&lt;0)
  ? &quot;keine Lösung&quot;&lt;&lt;endl
  : (D&gt;0)
    ? &quot;Zwei Lösungen: x0=&quot;&lt;&lt; p/2+sqrt(D) &lt;&lt;&quot;, x1=&quot;&lt;&lt; p/2-sqrt(D) &lt;&lt;endl
    : &quot;Eine Lösung: x=&quot;&lt;&lt; p/2 &lt;&lt;endl;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/967754</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/967754</guid><dc:creator><![CDATA[CStoll (off)]]></dc:creator><pubDate>Mon, 16 Jan 2006 09:22:56 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Mon, 16 Jan 2006 10:58:53 GMT]]></title><description><![CDATA[<p>an der uni eistieg in c++<br />
ist sehr schwer diese(?:) zu verstehn if glaube ich ist einfaecher<br />
ich habe wieder werzucht aber es klappt nicht sch......<br />
ich habe den text in tutorium 100 mal gelesen aber dort es gibt keine konkrete<br />
bsp<br />
sind einige bsp die einfach sind</p>
<p>mfg anndy</p>
]]></description><link>https://www.c-plusplus.net/forum/post/967831</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/967831</guid><dc:creator><![CDATA[anddy007]]></dc:creator><pubDate>Mon, 16 Jan 2006 10:58:53 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Mon, 16 Jan 2006 11:01:07 GMT]]></title><description><![CDATA[<p>so sollte sein<br />
[cpp]ist sehr schwer diese( ? : )zu verstehn if glaube ich ist einfaecher[cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/967835</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/967835</guid><dc:creator><![CDATA[anddy007]]></dc:creator><pubDate>Mon, 16 Jan 2006 11:01:07 GMT</pubDate></item><item><title><![CDATA[Reply to quadratische Gleichung was ist hier falsch bitte? on Mon, 16 Jan 2006 11:06:28 GMT]]></title><description><![CDATA[<p>anddy007 schrieb:</p>
<blockquote>
<p>ist sehr schwer diese ( ? : ) zu verstehn if glaube ich ist einfaecher</p>
</blockquote>
<p>Ja, if() ist einfacher zu verstehen und idR auch flexibler, aber wenn du auf ?: bestehst, mußt du da durch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/967844</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/967844</guid><dc:creator><![CDATA[CStoll (off)]]></dc:creator><pubDate>Mon, 16 Jan 2006 11:06:28 GMT</pubDate></item></channel></rss>