Using the Runge-Kutta method, display a table of the fraction of a radioactive material left after a certain number of years of decay. Also display the exact values using the solution y=e^(-cx)
What will be an ideal response?
```
int main()
{
double halflife;
int years, inc;
cout << endl << "Please enter the half-life of the radiocative material => ";
cin >> halflife;
cout << endl << "Please enter the number of years of decay to display => ";
cin >> years;
cout << endl << "Please enter the year increment to display => ";
cin >> inc;
cout << endl << "Fraction of Radioactive Material Left" << endl
<< endl << "Years" << setw(10) << "Approx" << setw(10)
<< "Exact" << endl << "-------------------------" << endl;
double material = 1.0;
for (int i = 0; i < = years; I += inc) {
for (int j = 0; (j < 10 * inc && I > 0); ++j)
// calculate 10 times per year
material = rungekutta(material, halflife);
cout << setw(5) << i << setiosflags(ios::showpoint|ios::fixed)
<< setprecision(4) << setw(10) << material
<< setw(10) << f(i, halflife) << endl;
}
cout << endl;
return 0;
}
```