Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## #118 Wrong Result without a cout &lt;&lt; endl!!!

OTHER
closed
Earnie Boyd
None
out-of-date
No_User_Response
2013-01-27
2002-03-11
Michael K
No

Sorry for my bad English but im from Germany.
I dont know why this BUG(?) appear. First I had a
debug text where the cout &lt;&lt; endl; stoods. But when I
was ready with the programm I delet this text and
suddenly ther were wrong REsults. Is this a BUG?

#include&lt;iostream&gt;
#include&lt;iomanip&gt;
#include&quot;mymath.h&quot;
using namespace std;

#define LEN 3

int main()
{
double matrix[LEN][LEN] = {{-4,3,-2},{5,4,-6},
{-3,2,4}}, // matrix initialisieren
rechteSeite[LEN] = {8,-
8,19}, // ergebnisse der
Therme
d
[LEN+1];
// ergebnisse von Dx/D (Cramer'sche Regel)

// Ausgabe der Therme:
for(int i = 0; i &lt; LEN; ++i)
{
cout &lt;&lt; i+1 &lt;&lt; &quot;: &quot;;
for(int j = 0; j &lt; LEN; ++j)
{
cout &lt;&lt; &quot;(&quot; &lt;&lt; setw(5) &lt;&lt; matrix[i][j]
&lt;&lt; &quot;)&quot; &lt;&lt; (char)(97 + i);
if(j != LEN-1) cout &lt;&lt; &quot; + &quot;;
}
cout &lt;&lt; &quot; = &quot; &lt;&lt; rechteSeite[i] &lt;&lt; endl;
}
cout &lt;&lt; endl;

// Berechnung der Determinanten:
d[0] = determ(*matrix, LEN);
for(int i = 0; i &lt; LEN; ++i) // alle
Determinanten ausrechnen
{
double determinante[LEN][LEN];
for(int n = 0; n &lt; LEN; ++n)
{
for(int m = 0; m &lt; LEN; ++m)
{
if(m == i) determinante[n][m] =
rechteSeite[n];
else determinante[n][m] = matrix[n][m];
}
}
cout &lt;&lt; endl; // if i delete this, the
prog write wrong result.
d[i+1] = determ(*determinante, LEN);
}

// Ausgabe der Werte der Determinanten;
for(int i = 0; i &lt; LEN+1; ++i)
cout &lt;&lt; &quot;D&quot; &lt;&lt; i &lt;&lt; &quot; = &quot; &lt;&lt; d[i] &lt;&lt; endl;

// Ausgabe der Ergebnisse:
cout &lt;&lt; &quot;\n\n&quot;;
for(int i = 0; i &lt; LEN; ++i)
cout &lt;&lt; (char)(97+i) &lt;&lt; &quot; = &quot; &lt;&lt; (float)d
[i+1] / d[0] &lt;&lt; endl;

cin.sync(); cin.clear(); cin.get();
return 0;
}

## Discussion

• Luke Dunstan
2002-05-22

Logged In: YES
user_id=30442

I cannot compile this because it uses the &quot;mymath.h&quot; header,
which is not provided.

• Danny Smith
2002-08-01

Logged In: YES
user_id=11494

No feedback provided {missing header], so cant' see the
bug. Can you please provide preprocessed source (the
*.ii file output by --save-temps).

danny

• Earnie Boyd
2002-08-05

• assigned_to: nobody --> earnie
• status: open --> closed-out-of-date

• Earnie Boyd
2013-01-27

• status: closed-out-of-date --> closed
• resolution: --> out-of-date
• category: --> No_User_Response
• milestone: --> OTHER