testing user inputs

This commit is contained in:
Pim Nelissen
2025-11-04 23:24:48 +01:00
parent bcd4a86d7a
commit 0ad5013392

26
RadioactiveDecay/main.cpp Normal file
View 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;
}