testing user inputs
This commit is contained in:
26
RadioactiveDecay/main.cpp
Normal file
26
RadioactiveDecay/main.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int N(int N0, float t, float t12)
|
||||||
|
{
|
||||||
|
return N0 * pow(.5, (t/t12));
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
float t12;
|
||||||
|
int N0;
|
||||||
|
float t;
|
||||||
|
|
||||||
|
cout << "What's the half-life of your isotope?: ";
|
||||||
|
cin >> t12;
|
||||||
|
cout << "What's the initial population N0?: ";
|
||||||
|
cin >> N0;
|
||||||
|
cout << "What time t do you want to evaluate N(t)? (use same unit of time): ";
|
||||||
|
cin >> t;
|
||||||
|
|
||||||
|
cout << "The population at time " << t << " is " << N(N0, t, t12);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user