Sorry guys..
What I meant was.. I get the first value using c.getr(r), then i pass that value to c.area and the result is returned and printed.
Debugging the code, it looks like everything is ok, but the result shown at the end is not correct.
i.e.: input: 5, then c.area returns 5*5*3.14..=78.54, but printf returns a wrong value (154145820).
If I set a breakpoint right before printf"Area: %ld", c.area());, the value shown for void cerchio::area is correct (78.54).
I hope this helps more.
You're the man..
Anyway, I thought I had already tried that solution (I spent more then an hour, trying different solutions, but always getting the same, wrong result..);
and why use C?
What did you mean with that??
I know that's a stupid, useless function, but i'm just getting started with c++.
Those are C headers and functions. In C++, we usually use #include <iostream> for I/O. But the C library is also included in C++ but with prefix C and no file extension.
What's wrong with this??
Instead of printing "Hello world", it prints "_#รค", or something different everytime I run the exe.
Using cout, it works obviously, but I'd like to understand what's wrong with it, and if it's correct to use this function (I'm getting mad learning all these function (fprint, fprintf, fscanf............))!!
Thx in advance!
Damiano.
I don't really want to mix them.
So, cin >> for input and cout << for output. Got it.
Sometimes I see void main, sometimes int main..
I don't know what's the difference between, but I believe that what you're telling me is right.
So from now on it will always be int main! :-)
Thank you very much!! :-)