hallo,
habe ein problem, das mich langsam zur verzweiflung treibt: also, ich führe folgendes programm aus:
eigentlich müsste jetzt x = 100 sein, ist es auch, wenn ich das "cout a b" in der funktion f auskommentiere. wenn ich den code aber wie oben, mit dem cout in f ausführe, ist x = 99Code:#include <iostream> int f(double a, double b) { int x = a/b; std::cout << a << " " << b << std::endl; return x; } int main(int argc, char** argv) { double a(1.0), b(0.01); int x = f(a,b); std::cout << x << std::endl; return 0; }
ich kann mir das einfach nicht erklären.. woran liegt das? danke für eure hilfe!
(kompiliert unter ubuntu mit g++)
Lesezeichen