<?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[Gaußscher Algorithmus]]></title><description><![CDATA[<p>Hallo Liebe Leute,</p>
<p>ich bin Student der Fachrichtung Schiffsbetriebstechnik und wir sollen als Hausarbeit ein Programm mit C++ erstellen. Da unser Dozent nicht wirklich eine Hilfe ist habe ich große Schwierigkeiten und erhoffe mir hier Hilfe.</p>
<p>Ich möchte zu folgendem Programm ein Struktogramm erstellen. Könnte mir da jemand behilflich sein?</p>
<p>Danke, Bonjasky..........</p>
<p>/<em>--------------------------------------------------</em>/<br />
/* Aufgabe : Gaußscher Algorithmus zur Lösung */<br />
/* Linearer Gleichungssysteme (n Gleich- <em>/<br />
/* -ungen mit n Unbekanten) <em>/<br />
/</em>--------------------------------------------------</em>/<br />
/* */<br />
/* Eingabe: Anzahl der Gleichungen */<br />
/* Koeffizienten des Gleichungssystems */<br />
/* (zeilenweise) */<br />
/* Ausgabe: Gestaffeltes System der Gleichungen <em>/<br />
/* Lösungsvektor mit n Lösungen X1 bis Xn <em>/<br />
/</em>--------------------------------------------------</em>/<br />
#include &lt;iostream.h&gt;<br />
#include &lt;conio.h&gt;<br />
#include &lt;stdio.h&gt;<br />
#include &lt;iomanip.h&gt;<br />
#include &lt;math.h&gt;</p>
<p>void gauss(double a[][12], int n);<br />
void loes(double a[][12], int n, double l[]);</p>
<p>int main(void)<br />
{<br />
double a[11][12], l[11];<br />
int n, i, j;<br />
/*<br />
n = 4;<br />
a[1][1] = 1; a[1][2] = -3; a[1][3] = 1.5; a[1][4] = -1; a[1][5] = -10.4;<br />
a[2][1] = -2; a[2][2] = 1; a[2][3] = 3.5; a[2][4] = 2; a[2][5] = -16.5;<br />
a[3][1] = 1; a[3][2] = -2; a[3][3] = 1.2; a[3][4] = 2; a[3][5] = 0;<br />
a[4][1] = 3; a[4][2] = 1; a[4][3] = -1; a[4][4] = -3; a[4][5] = -0.7;<br />
*/<br />
cout&lt;&lt;&quot;-- Gausscher Algorithmus zur Loesung Linearer Gleichungssysteme --&quot;;<br />
cout&lt;&lt;endl&lt;&lt;endl;<br />
/* Eingaben */<br />
cout &lt;&lt; &quot;Anzahl der Gleichungen &gt; &quot;;<br />
cin &gt;&gt; n;<br />
cout &lt;&lt; endl;<br />
for(i = 1; i &lt;= n; i = i + 1)<br />
for(j = 1; j &lt;= n + 1; j = j + 1)<br />
{<br />
cout&lt;&lt;&quot;Koeffizient [&quot;&lt;&lt;i&lt;&lt;&quot;][&quot;&lt;&lt;j&lt;&lt;&quot;] &gt; &quot;;<br />
cin &gt;&gt; a[i][j];<br />
}</p>
<p>/* Gauásches Eliminationsverfahren */</p>
<p>gauss(a, n);<br />
cout &lt;&lt; &quot;\nGestaffeltes System der Gleichungen: &quot;;<br />
for(i = 1; i &lt;= n; i = i + 1)<br />
{<br />
cout &lt;&lt; endl;<br />
for(j = 1; j &lt;= n+1; j = j + 1)<br />
cout &lt;&lt; setw(8)&lt;&lt;fixed&lt;&lt;setprecision(2)&lt;&lt; a[i][j];<br />
}<br />
/* Ausgabe des Lösungsvektors */<br />
loes(a, n, l);<br />
cout &lt;&lt;&quot;\n\nLoesungsvektor: &quot;;<br />
for(i = 1; i &lt;= n; i = i + 1)<br />
cout &lt;&lt;&quot;\nX&quot;&lt;&lt; i &lt;&lt;&quot; = &quot;&lt;&lt;setw(7)&lt;&lt;fixed&lt;&lt;setprecision(4)&lt;&lt;l[i];<br />
cout &lt;&lt; &quot;\n\nEnde &lt;Taste&gt;&quot;;<br />
getch();<br />
return (0);<br />
}</p>
<p>/* Gauásches Eliminationsverfahren zur Lösung linearer Gleichungssysteme */<br />
void gauss(double a[][12], int n)<br />
{<br />
int i, j, s;<br />
double fak, vek[12];</p>
<p>/* Schleife über die Zeilen (Gleichungen) 2 bis n */<br />
for(s = 2; s &lt;= n; s = s + 1)<br />
{<br />
/* Schleife über die noch nicht eliminierten Zeilen */<br />
for(i = s; i &lt;= n; i = i + 1)<br />
{<br />
/* Faktor berechnen: -a21/a11, -a31/a11, ..., -a32/a22, ... */<br />
if(a[s-1][s-1] == 0)<br />
cout &lt;&lt;&quot;\nGleichungssystem nicht lösbar &quot;;<br />
fak = -(a[i][s-1] / a[s-1][s-1]);<br />
/* Zeile 1 * Faktor zu Zeile 2 addieren, u.s.w. */<br />
for(j = s-1; j &lt;= n + 1; j = j + 1)<br />
{<br />
vek[j] = a[s-1][j] * fak;<br />
a[i][j] = a[i][j] + vek[j];<br />
}<br />
}<br />
}<br />
}</p>
<p>/* Sukzessive Bestimmung der Unbekannten */<br />
void loes(double a[][12], int n, double l[])<br />
{<br />
int i, j, s, typ;<br />
double sum;</p>
<p>for(i = n; i &gt;= 1; i = i - 1)<br />
{<br />
sum = 0;<br />
for(j = 1; j &lt;= n; j = j + 1)<br />
if(j != i) sum = sum + a[i][j];<br />
sum = a[i][n+1] - sum;<br />
if(a[i][i] == 0)<br />
{<br />
typ = 0;<br />
for(i = 1; i &lt;= n; i = i + 1)<br />
if(a[i][n+1] != 0) typ = 1;<br />
if(typ == 0) cout&lt;&lt;&quot;\nUnendlich viele Lösungen&quot;;<br />
if(typ == 1) cout&lt;&lt;&quot;\nGleichungssystem nicht lösbar&quot;;<br />
}<br />
l[i] = sum / a[i][i];<br />
for(s = n - 1; s &gt;= 1; s = s - 1)<br />
a[s][i] = a[s][i] * l[i];<br />
}<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/183807/gaußscher-algorithmus</link><generator>RSS for Node</generator><lastBuildDate>Wed, 23 Sep 2026 10:41:50 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/183807.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 08 Jun 2007 20:24:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Gaußscher Algorithmus on Fri, 08 Jun 2007 20:24:49 GMT]]></title><description><![CDATA[<p>Hallo Liebe Leute,</p>
<p>ich bin Student der Fachrichtung Schiffsbetriebstechnik und wir sollen als Hausarbeit ein Programm mit C++ erstellen. Da unser Dozent nicht wirklich eine Hilfe ist habe ich große Schwierigkeiten und erhoffe mir hier Hilfe.</p>
<p>Ich möchte zu folgendem Programm ein Struktogramm erstellen. Könnte mir da jemand behilflich sein?</p>
<p>Danke, Bonjasky..........</p>
<p>/<em>--------------------------------------------------</em>/<br />
/* Aufgabe : Gaußscher Algorithmus zur Lösung */<br />
/* Linearer Gleichungssysteme (n Gleich- <em>/<br />
/* -ungen mit n Unbekanten) <em>/<br />
/</em>--------------------------------------------------</em>/<br />
/* */<br />
/* Eingabe: Anzahl der Gleichungen */<br />
/* Koeffizienten des Gleichungssystems */<br />
/* (zeilenweise) */<br />
/* Ausgabe: Gestaffeltes System der Gleichungen <em>/<br />
/* Lösungsvektor mit n Lösungen X1 bis Xn <em>/<br />
/</em>--------------------------------------------------</em>/<br />
#include &lt;iostream.h&gt;<br />
#include &lt;conio.h&gt;<br />
#include &lt;stdio.h&gt;<br />
#include &lt;iomanip.h&gt;<br />
#include &lt;math.h&gt;</p>
<p>void gauss(double a[][12], int n);<br />
void loes(double a[][12], int n, double l[]);</p>
<p>int main(void)<br />
{<br />
double a[11][12], l[11];<br />
int n, i, j;<br />
/*<br />
n = 4;<br />
a[1][1] = 1; a[1][2] = -3; a[1][3] = 1.5; a[1][4] = -1; a[1][5] = -10.4;<br />
a[2][1] = -2; a[2][2] = 1; a[2][3] = 3.5; a[2][4] = 2; a[2][5] = -16.5;<br />
a[3][1] = 1; a[3][2] = -2; a[3][3] = 1.2; a[3][4] = 2; a[3][5] = 0;<br />
a[4][1] = 3; a[4][2] = 1; a[4][3] = -1; a[4][4] = -3; a[4][5] = -0.7;<br />
*/<br />
cout&lt;&lt;&quot;-- Gausscher Algorithmus zur Loesung Linearer Gleichungssysteme --&quot;;<br />
cout&lt;&lt;endl&lt;&lt;endl;<br />
/* Eingaben */<br />
cout &lt;&lt; &quot;Anzahl der Gleichungen &gt; &quot;;<br />
cin &gt;&gt; n;<br />
cout &lt;&lt; endl;<br />
for(i = 1; i &lt;= n; i = i + 1)<br />
for(j = 1; j &lt;= n + 1; j = j + 1)<br />
{<br />
cout&lt;&lt;&quot;Koeffizient [&quot;&lt;&lt;i&lt;&lt;&quot;][&quot;&lt;&lt;j&lt;&lt;&quot;] &gt; &quot;;<br />
cin &gt;&gt; a[i][j];<br />
}</p>
<p>/* Gauásches Eliminationsverfahren */</p>
<p>gauss(a, n);<br />
cout &lt;&lt; &quot;\nGestaffeltes System der Gleichungen: &quot;;<br />
for(i = 1; i &lt;= n; i = i + 1)<br />
{<br />
cout &lt;&lt; endl;<br />
for(j = 1; j &lt;= n+1; j = j + 1)<br />
cout &lt;&lt; setw(8)&lt;&lt;fixed&lt;&lt;setprecision(2)&lt;&lt; a[i][j];<br />
}<br />
/* Ausgabe des Lösungsvektors */<br />
loes(a, n, l);<br />
cout &lt;&lt;&quot;\n\nLoesungsvektor: &quot;;<br />
for(i = 1; i &lt;= n; i = i + 1)<br />
cout &lt;&lt;&quot;\nX&quot;&lt;&lt; i &lt;&lt;&quot; = &quot;&lt;&lt;setw(7)&lt;&lt;fixed&lt;&lt;setprecision(4)&lt;&lt;l[i];<br />
cout &lt;&lt; &quot;\n\nEnde &lt;Taste&gt;&quot;;<br />
getch();<br />
return (0);<br />
}</p>
<p>/* Gauásches Eliminationsverfahren zur Lösung linearer Gleichungssysteme */<br />
void gauss(double a[][12], int n)<br />
{<br />
int i, j, s;<br />
double fak, vek[12];</p>
<p>/* Schleife über die Zeilen (Gleichungen) 2 bis n */<br />
for(s = 2; s &lt;= n; s = s + 1)<br />
{<br />
/* Schleife über die noch nicht eliminierten Zeilen */<br />
for(i = s; i &lt;= n; i = i + 1)<br />
{<br />
/* Faktor berechnen: -a21/a11, -a31/a11, ..., -a32/a22, ... */<br />
if(a[s-1][s-1] == 0)<br />
cout &lt;&lt;&quot;\nGleichungssystem nicht lösbar &quot;;<br />
fak = -(a[i][s-1] / a[s-1][s-1]);<br />
/* Zeile 1 * Faktor zu Zeile 2 addieren, u.s.w. */<br />
for(j = s-1; j &lt;= n + 1; j = j + 1)<br />
{<br />
vek[j] = a[s-1][j] * fak;<br />
a[i][j] = a[i][j] + vek[j];<br />
}<br />
}<br />
}<br />
}</p>
<p>/* Sukzessive Bestimmung der Unbekannten */<br />
void loes(double a[][12], int n, double l[])<br />
{<br />
int i, j, s, typ;<br />
double sum;</p>
<p>for(i = n; i &gt;= 1; i = i - 1)<br />
{<br />
sum = 0;<br />
for(j = 1; j &lt;= n; j = j + 1)<br />
if(j != i) sum = sum + a[i][j];<br />
sum = a[i][n+1] - sum;<br />
if(a[i][i] == 0)<br />
{<br />
typ = 0;<br />
for(i = 1; i &lt;= n; i = i + 1)<br />
if(a[i][n+1] != 0) typ = 1;<br />
if(typ == 0) cout&lt;&lt;&quot;\nUnendlich viele Lösungen&quot;;<br />
if(typ == 1) cout&lt;&lt;&quot;\nGleichungssystem nicht lösbar&quot;;<br />
}<br />
l[i] = sum / a[i][i];<br />
for(s = n - 1; s &gt;= 1; s = s - 1)<br />
a[s][i] = a[s][i] * l[i];<br />
}<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1301660</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1301660</guid><dc:creator><![CDATA[bonjasky]]></dc:creator><pubDate>Fri, 08 Jun 2007 20:24:49 GMT</pubDate></item><item><title><![CDATA[Reply to Gaußscher Algorithmus on Fri, 08 Jun 2007 20:49:07 GMT]]></title><description><![CDATA[<p>Zuerst mal den Code in Tags packen...<br />
<a href="http://c-plusplus.net/forum/viewtopic.php?t=39411" rel="nofollow">http://c-plusplus.net/forum/viewtopic.php?t=39411</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1301673</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1301673</guid><dc:creator><![CDATA[Kuldren]]></dc:creator><pubDate>Fri, 08 Jun 2007 20:49:07 GMT</pubDate></item><item><title><![CDATA[Reply to Gaußscher Algorithmus on Sat, 09 Jun 2007 06:55:58 GMT]]></title><description><![CDATA[<p>Kann mir kaum vorstellen, das sich jemand die Mühe macht.</p>
<p>Im www findest du jedoch fertige Struktogramme ohne ende, z.B. hier<br />
<a href="http://www.luk-korbmacher.de/Schule/Wissen/gauss.htm" rel="nofollow">http://www.luk-korbmacher.de/Schule/Wissen/gauss.htm</a><br />
Da das Vorgehen beim Gaußschen Algorithmus prinzipiell stets das gleiche ist, dürftest du damit wohl kaum etwas falsch machen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1301780</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1301780</guid><dc:creator><![CDATA[proggingmania]]></dc:creator><pubDate>Sat, 09 Jun 2007 06:55:58 GMT</pubDate></item><item><title><![CDATA[Reply to Gaußscher Algorithmus on Sat, 09 Jun 2007 20:36:08 GMT]]></title><description><![CDATA[<p>Ich machs für Bares! Bei Interesse überweis mir....80€!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1302223</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1302223</guid><dc:creator><![CDATA[Kohle]]></dc:creator><pubDate>Sat, 09 Jun 2007 20:36:08 GMT</pubDate></item></channel></rss>