Answer to Question #182572 in C++ for Mridul

Question #182572

Radioactive decay of radioactive materials can be modeled by the equation A = A0e−t(log2/h) where A is amount of material at time t, A0 is the material at time 0, and h is the half-life of the radio active material.

Technetium-99m is a radioisotope that is used in imaging of the brain. It has a half-life of 6 hours. Your program should display the relative amount of A/A0 in a patient body every hour for 24 hours after receiving the a dose. Prompt user for the initial dose (A0) in millicuries (mci). Typical values range from 3.8 - 15 millicuries. However, you can use any value for this program. Even milligrams. Enter values without negative exponents. If you want to enter 15 milligrams, enter 15. Same, for millicuries.


Display your results in a table, the first column showing hours beginning at 0, and ending at 24. The second column shows the ratio of A/A0 beginning at hour 0 when the ratio is 1.

Make sure that only positive values are entered for the initial dose using a do/while loop.


1
Expert's answer
2021-04-19T14:35:04-0400
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <iomanip>
 
 
using namespace std;
 
int main()
{
	double A0;
	double t = 0;
	int time = 0;
	double h = 6;
	while (true)
	{
		cout << "Enter A0 (3.8 - 15) milligrams: ";
		cin >> A0;
		if (A0 < 0) cout << "Wrong value!" << endl;
		else break;
	}
	cout << "Hours\tRatio of A/A0\tMilligrams" << endl;
	cout << fixed << setprecision(3);
	do
	{
		cout << time << "\t" << (A0 * pow(M_E, -t * log(2) / h)) / A0 << "\t\t" << (A0 * pow(M_E, -t * log(2) / h)) << endl;
		t++;
		time++;
	} while (time < 25);
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS