Forum
Komische Fehlermeldung (Computertechnik)
Inzwischen habe ich die Fehlermeldung beheben können, dennoch ist ein neues Problem aufgetaucht.
Ich wollte zu den Rechenoperationen
->+
->-
->*
->/
->Wurzl
noch die Potenzfunktion hinzufügen.
Hier der Quellcode:
#include
#include
using namespace std;
float Add(float a, float b)
{
cout << endl;
cout << "Addition!" << endl;
cout << "Zwei Zahlen bitte!" << endl;
cin >> a >> b;
float c = a + b;
cout << a << " + " << b << " = " << c << endl;
cout << endl;
return c;
}
float Sub(float d, float e)
{
cout << endl;
cout << "Subtraktion!" << endl;
cout << "Zwei Zahlen bitte!" << endl;
cin >> d >> e;
float f = d - e;
cout << d << " - " << e << " = " << f << endl;
cout << endl;
return f;
}
float Mul(float g, float h)
{
cout << endl;
cout << "Multiplikation!" << endl;
cout << "Zwei Zahlen bitte!" << endl;
cin >> g >> h;
float i = g*h;
cout << g << " * " << h << " = " << i << endl;
cout << endl;
return i;
}
float Div(float j, float k)
{
cout << endl;
cout << "Division!" << endl;
cout << " Zwei Zahlen bitte, jedoch darf der Zähler nicht 0 sein!" << endl;
cin >> j >> k;
float l = j/k ;
cout << j << " / " << k << " = " << l << endl;
cout << endl;
return l;
}
float Wurzel(float m)
{
cout << endl;
cout << "Quadratwurzel!" << endl;
cout << "Eine Zahl bitte!" << endl;
cin >> m;
float n = sqrt (m);
cout << "Ergebnis ist " << n << endl;
cout << endl;
return n;
}
float Potenz(float o, float p)
{
cout << endl;
cout << "Potenz!" << endl;
cout << "Zwei Zahlen bitte!" << endl;
cin >> o >> p;
float q=pow(o,p);
cout << "Ergebnis ist " << q << endl;
return q;
}
int main()
{
float a=0,b=0,c=0;
float d=0,e=0,f=0;
float g=0,h=0,i=0;
float j=0,k=0,l=0;
float m=0,n=0;
float o=0,p=0,q=0;
cout << "Rechenoperationen!" << endl;
c=Add(a,b);
f=Sub(d,e);
i=Mul(g,h);
l=Div(j,k);
n=Wurzel(m);
q=pow(o,p);
return 0;
}
Beim Kompilieren kommt keine Fehlermeldung. Bloß beim Starten ohne Debugging taucht die Potenzfunktion einfach nicht auf, die Ausgabe hört einfach nach der Wurzelfunktion auf zu arbeiten.
Kann mir jemand von euch einen Tipp geben?
Danke für die Antworten im Voraus.
Gruß
Max
--
Where is the madness ...
Gesamter Thread:
