2 Questions

Help needed Fellows.....
1) The memory is reserved for variables during compiling or during execution?????
2) I want to find a^b. Is it better to use cmath and built in function of power i.e pow(a,b) or should i build my own?????
1.) Execution of course...everything might as well be a global if it was reserved during compiling.
2.) pow()...how exactly do you plan to deal with something like customPow(a, 0.47)?
I think using
"binomial series"
not sure as i am not considering it in depth for the time being. Ok if i am dealing with positive integers only, then it will be simple to build(or not???). Actually i want to ask that including header files for simple tasks is good programing practice or not???
You should avoid reinventing the wheel. Use what is available.
I am not interested in reinventing the wheel and even if i am, i can't do perfectly. My concepts are weak in c++. I think including header file includes its code not visible to us in the current file in which we are working. If target can be achieved by just a function of 5 to 10 lines then is it better(wrt efficiency) to use it instead of including the code of hundred lines of header file. I know it doesn't matter a lot in mini projects. Is it right or all this discussion is meaningless???
#include lets the precompiler add the appropriate code so the compiler gets what it needs when it compiles the code. If you don't want to pollute the global namespace then try only using what you need.

Imagine writing a very simple program with just like cin, cout, endl...but we still include <iostream>.

[edited]
In addition, using what is already built makes the code easier to maintain, and easier to understand for the people that look at your code, or for yourself when you come back to it, who knows, several months later.
Last edited on
Hit right on the target.Thanks wmheric.
Topic archived. No new replies allowed.