Question: Please write this in C + + using a while and if loop. Radioactive Decay This problem is based on the explanation of Chapter 5
Please write this in C using a while and if loop. Radioactive Decay
This problem is based on the explanation of Chapter Problem # That problem describes how you
calculate radioactive decay from a half life. This is the function you must build:
Chapter question
int yearstodecaydouble startingamount, double target;
Given a startamount of Cobalt and a target for how radioactive you want it to be you must compute
how many whole years it will take to get below that target. The return type of this is an int, so you can just
walk through years from to whatever until the amount remaining is less than the target.
With C there's a little complication to this. You need the constant for If you include math.h you'll get
a constant ME that evaluates to That include file also gives you pow that raises to the power.
However, there's where the complication comes. In order to make the compiled files as small as possible,
the linker only includes the bare minimum functionality. I think that requires a bit more explanation
So with this project, our code is in two separate c files. The compiler actually compiles each of them
separately. Then another program, called the linker, puts those compiled files together to build the runnable
file. The linker also includes code for things like printf. However, in order to keep our executables small,
the linker only includes the bare minimum of extra libraries. We're going to have to figure out how to tell
it to include the math library. Yes it feels like we did that when we included math.h That was enough to
make it compile, but the h file only includes descriptions of the code. Now we have to tell the linker where
to find the functions that math.h referred to There's one more file in your project that is telling the machine
how to put the stuff together to build your executable. CMakeLists.txt:
cmakeminimumrequiredVERSION
project Loops
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
