<?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[Mathematische Probleme mit if-Befehlen]]></title><description><![CDATA[<p>Hallo Leute, ich bin ein absoluter Neuling was C++ anbelangt und wende mich an euch in der Hoffnung dass ihr mir helfen könnt...</p>
<p>Haben drei Matheaufgaben (a,b,c) bekommen, die wir anhand von zwei Veriablen (x,y) berechnen lassen können...<br />
Nun haben wir bei Aufgabe b das Problem, dass hier ein Wurzelausdruck (nicht kleiner Null), ein Logarithmusausdruck (ungleich Null) und ein Nenner (ungleich Null) mit dabei sind... Diese drei Fälle sollen wir nun deklarieren mit if-Befehlen und wenn einer der drei gerade genannten Fälle auftritt, soll eine Fehlermeldung in Form von &quot;Kann nicht gelöst werden&quot; oder so ähnlich an stelle von b ausgespuckt werden.</p>
<p>Im Folgenden meine Lösungsidee, die leider nicht funktioniert...<br />
Könnt ihr mir (weiter-)helfen?</p>
<p>Die Mathematischen Berechnungen stimmen alle von der Schreibweise...</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cmath&gt;
using namespace std;
void main()
{
	double a, b, c, x, y;
	const double PI = 3.14159;
	cout &lt;&lt; &quot;Geben Sie einen Wert fuer x ein: &quot;;
	cin &gt;&gt; x ; 
	cout &lt;&lt; &quot;Geben Sie einen Wert fuer y ein: &quot;;
	cin &gt;&gt; y;

	a = (pow((sin(x + PI) + 0.3 * pow(cos(x),2.)),2.)) / (sqrt(pow(x,2.) + pow(y,2.) + 1.0)) + exp(-(x+1.0));		
	cout &lt;&lt; &quot;a = &quot; &lt;&lt; a &lt;&lt; endl;

	b = (log(fabs(x - 4.0 + y)) + sqrt(9.0+x)) / (-pow(y,2.) * (x - 2.0));
	cout &lt;&lt; &quot;b= &quot; &lt;&lt; b &lt;&lt; endl;

		if x &lt; -9 then cout &lt;&lt; &quot;negativer Ausdruck unter der Klammer -&gt; Aufgabe nicht lösbar&quot; &lt;&lt; 

		elseif x - 4 + y = 2 then cout &quot;Logarithmus muss ungleich Null sein -&gt; Aufgabe nicht lösbar&quot; &lt;&lt;

		elseif y = 0 or x = 2 then cout &quot;Null im Nenner ist nicht definiert -&gt; Aufgabe nicht lösbar&quot; &lt;&lt; endif

	c = (((2.0 + x * y) / 3.0)+((2.0/3.0) * x * y - 1.0)) / (4.0 * pow(x,2.) * pow(y,2.) + 2.0);
	cout &lt;&lt; &quot;c= &quot; &lt;&lt; c &lt;&lt; endl;
</code></pre>
<p>Hier nochmal der arithmetische Ausdruck von b:</p>
<p><a href="http://img535.imageshack.us/img535/9421/hinweiszuaufg03.jpg" rel="nofollow">http://img535.imageshack.us/img535/9421/hinweiszuaufg03.jpg</a></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/294639/mathematische-probleme-mit-if-befehlen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 19:48:35 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/294639.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 28 Oct 2011 18:34:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Mathematische Probleme mit if-Befehlen on Fri, 28 Oct 2011 18:39:13 GMT]]></title><description><![CDATA[<p>Hallo Leute, ich bin ein absoluter Neuling was C++ anbelangt und wende mich an euch in der Hoffnung dass ihr mir helfen könnt...</p>
<p>Haben drei Matheaufgaben (a,b,c) bekommen, die wir anhand von zwei Veriablen (x,y) berechnen lassen können...<br />
Nun haben wir bei Aufgabe b das Problem, dass hier ein Wurzelausdruck (nicht kleiner Null), ein Logarithmusausdruck (ungleich Null) und ein Nenner (ungleich Null) mit dabei sind... Diese drei Fälle sollen wir nun deklarieren mit if-Befehlen und wenn einer der drei gerade genannten Fälle auftritt, soll eine Fehlermeldung in Form von &quot;Kann nicht gelöst werden&quot; oder so ähnlich an stelle von b ausgespuckt werden.</p>
<p>Im Folgenden meine Lösungsidee, die leider nicht funktioniert...<br />
Könnt ihr mir (weiter-)helfen?</p>
<p>Die Mathematischen Berechnungen stimmen alle von der Schreibweise...</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cmath&gt;
using namespace std;
void main()
{
	double a, b, c, x, y;
	const double PI = 3.14159;
	cout &lt;&lt; &quot;Geben Sie einen Wert fuer x ein: &quot;;
	cin &gt;&gt; x ; 
	cout &lt;&lt; &quot;Geben Sie einen Wert fuer y ein: &quot;;
	cin &gt;&gt; y;

	a = (pow((sin(x + PI) + 0.3 * pow(cos(x),2.)),2.)) / (sqrt(pow(x,2.) + pow(y,2.) + 1.0)) + exp(-(x+1.0));		
	cout &lt;&lt; &quot;a = &quot; &lt;&lt; a &lt;&lt; endl;

	b = (log(fabs(x - 4.0 + y)) + sqrt(9.0+x)) / (-pow(y,2.) * (x - 2.0));
	cout &lt;&lt; &quot;b= &quot; &lt;&lt; b &lt;&lt; endl;

		if x &lt; -9 then cout &lt;&lt; &quot;negativer Ausdruck unter der Klammer -&gt; Aufgabe nicht lösbar&quot; &lt;&lt; 

		elseif x - 4 + y = 2 then cout &quot;Logarithmus muss ungleich Null sein -&gt; Aufgabe nicht lösbar&quot; &lt;&lt;

		elseif y = 0 or x = 2 then cout &quot;Null im Nenner ist nicht definiert -&gt; Aufgabe nicht lösbar&quot; &lt;&lt; endif

	c = (((2.0 + x * y) / 3.0)+((2.0/3.0) * x * y - 1.0)) / (4.0 * pow(x,2.) * pow(y,2.) + 2.0);
	cout &lt;&lt; &quot;c= &quot; &lt;&lt; c &lt;&lt; endl;
</code></pre>
<p>Hier nochmal der arithmetische Ausdruck von b:</p>
<p><a href="http://img535.imageshack.us/img535/9421/hinweiszuaufg03.jpg" rel="nofollow">http://img535.imageshack.us/img535/9421/hinweiszuaufg03.jpg</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2137263</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2137263</guid><dc:creator><![CDATA[kernseif]]></dc:creator><pubDate>Fri, 28 Oct 2011 18:39:13 GMT</pubDate></item><item><title><![CDATA[Reply to Mathematische Probleme mit if-Befehlen on Fri, 28 Oct 2011 18:37:12 GMT]]></title><description><![CDATA[<p>&quot;funktioniert nicht&quot; - die konkreteste Problembeschreibung, die das Forum je gesehen hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2137264</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2137264</guid><dc:creator><![CDATA[SG1]]></dc:creator><pubDate>Fri, 28 Oct 2011 18:37:12 GMT</pubDate></item><item><title><![CDATA[Reply to Mathematische Probleme mit if-Befehlen on Fri, 28 Oct 2011 18:40:10 GMT]]></title><description><![CDATA[<p>SG1 schrieb:</p>
<blockquote>
<p>&quot;funktioniert nicht&quot; - die konkreteste Problembeschreibung, die das Forum je gesehen hat.</p>
</blockquote>
<p>was willst du mir damit sagen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2137267</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2137267</guid><dc:creator><![CDATA[kernseif]]></dc:creator><pubDate>Fri, 28 Oct 2011 18:40:10 GMT</pubDate></item><item><title><![CDATA[Reply to Mathematische Probleme mit if-Befehlen on Fri, 28 Oct 2011 18:45:52 GMT]]></title><description><![CDATA[<p>du sollst konkret sagen, was nicht funktioniert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2137268</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2137268</guid><dc:creator><![CDATA[vario-500]]></dc:creator><pubDate>Fri, 28 Oct 2011 18:45:52 GMT</pubDate></item><item><title><![CDATA[Reply to Mathematische Probleme mit if-Befehlen on Fri, 28 Oct 2011 18:51:02 GMT]]></title><description><![CDATA[<blockquote>
<p>Diese drei Fälle sollen wir nun deklarieren mit if-Befehlen und wenn einer der drei gerade genannten Fälle auftritt, soll eine Fehlermeldung in Form von &quot;Kann nicht gelöst werden&quot; oder so ähnlich an stelle von b ausgespuckt werden.</p>
</blockquote>
<p>habe gedacht, das wäre klar... sorry.</p>
<p>Die folgenden drei Zeilen müssten &quot;modifiziert&quot; werden, damit er die Fehlermeldungen ausspuckt.</p>
<pre><code class="language-cpp">if x &lt; -9 then cout &lt;&lt; &quot;negativer Ausdruck unter der Klammer -&gt; Aufgabe nicht lösbar&quot; &lt;&lt; 

        elseif x - 4 + y = 2 then cout &quot;Logarithmus muss ungleich Null sein -&gt; Aufgabe nicht lösbar&quot; &lt;&lt;

        elseif y = 0 or x = 2 then cout &quot;Null im Nenner ist nicht definiert -&gt; Aufgabe nicht lösbar&quot; &lt;&lt; endif
</code></pre>
<p>Im Moment tippt man einen Wert für x und y ein und bekommt einen Wert für a,b und c raus. Wenn jetzt aber einer der oben genannten Fällte eintritt soll dann z.b. dastehen &quot;a = nicht lösbar&quot; oder so ähnlich...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2137272</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2137272</guid><dc:creator><![CDATA[kernseif]]></dc:creator><pubDate>Fri, 28 Oct 2011 18:51:02 GMT</pubDate></item><item><title><![CDATA[Reply to Mathematische Probleme mit if-Befehlen on Fri, 28 Oct 2011 20:08:21 GMT]]></title><description><![CDATA[<p>Und was funktioniert daran nicht, abgesehen davon, dass das BASIC und kein C++ ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2137303</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2137303</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Fri, 28 Oct 2011 20:08:21 GMT</pubDate></item><item><title><![CDATA[Reply to Mathematische Probleme mit if-Befehlen on Fri, 28 Oct 2011 20:12:01 GMT]]></title><description><![CDATA[<p>Probier mal:</p>
<pre><code class="language-cpp">if (x &lt; -9)
    cout &lt;&lt; &quot;negativer Ausdruck unter der Klammer -&gt; Aufgabe nicht lösbar&quot;;

else if ( (x - 4 + y) == 2)
    cout &lt;&lt; &quot;Logarithmus muss ungleich Null sein -&gt; Aufgabe nicht lösbar&quot;;

else if (y == 0 || x == 2)
    cout &lt;&lt; &quot;Null im Nenner ist nicht definiert -&gt; Aufgabe nicht lösbar&quot;;
</code></pre>
<p>mfg Ergar</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2137305</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2137305</guid><dc:creator><![CDATA[Ergar]]></dc:creator><pubDate>Fri, 28 Oct 2011 20:12:01 GMT</pubDate></item></channel></rss>