In: Computer Science
In a certain building at a top secret research lab , some yttrium-90 has leaked into the computer analysts' coffee room. The leak would currently expose personnel to 150 millirems of radiation a day. The half-life of the substance is about three days; that is, the radiation level is only half of what it was three days ago. The analysts want to know how long it will be before the radiation is down to a safe level of 0.466 millirem a day. They would like a chart that displays the radiation level for every three days with the message Unsafe or Safe after every line. The chart should stop just before the radiation level is one-tenth of the safe level, because the more cautious analysts will require a safety factor of 10. The program should also print the first day that the room can be entered.
#include <iostream>
using namespace std;
const float safeLevel =0.466;
void determine(){
cout<<"Radiation Chart"<<endl;
float level=150;
float cop=0;
cop=level;
int i=0;
for(int i=0;i<10;i++){
if(cop==5|| cop<15){
cout<<"DAY "<<i+1<< "Radiation Level:
"<<cop<<" Safe"<<endl;
cop=cop/2;
}
else{
cout<<"DAY "<<i+1<< "Radiation Level:
"<<cop<<" Unsafe"<<endl;
cop=cop/2;
}
}
}
int main()
{
determine();
return 0;
}
IF YOU HAVE ANY QUERY PLEASE COMMENT DOWN BELOW
PLEASE GIVE A THUMBS UP