This is my program to calculate the emitted power for two type of light.
After I change the normal if else statement to function , it cant run and I have no idea how to fix the problem. I think the problem is from the function.
PLEASE HELP ME :(
You cannot write lines like temp = temp();
I'm sure that your compiler tells you this. Either the variable or the function name will have to be changed.
You call callPower from main without having set the values of LL and UL: presumably you meant to set these in validateLimits, but you didn't return them as parameters.
In main, the arguments LL and UL are integers, yet in the function definition they are double. These must be made consistent. Given that they are used as the ends of a loop they should probably be integers (despite their physical meaning).
Other things:
Although they are major physical constants and hence candidates for global variables, Planck's constant h, Boltzmann constant k etc. are only used in power() - might be better to define them there.
Please write 1.0e-15, not pow(10.0, -15.0). Is this correct, anyway?
Presumably surface area is measured in mm squared, not mm. (Actually, unless there is a good reason to do otherwise I would be inclined to enter it in metres squared.)
Is there any good physical reason why you separate visible and ultraviolet spectra here?
I would watch out for significant over-runs with your exp() function in line 98. You could re-express the spectral density to avoid this if necessary.