From 0ad50133926d016948bd02ab1112a3ac271f27cf Mon Sep 17 00:00:00 2001 From: Pim Nelissen Date: Tue, 4 Nov 2025 23:24:48 +0100 Subject: [PATCH] testing user inputs --- RadioactiveDecay/main.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 RadioactiveDecay/main.cpp diff --git a/RadioactiveDecay/main.cpp b/RadioactiveDecay/main.cpp new file mode 100644 index 0000000..32380cb --- /dev/null +++ b/RadioactiveDecay/main.cpp @@ -0,0 +1,26 @@ +#include +#include + +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; +}