Most metals weaken as temperature increases. The Ultimate Tensile Strength (UTS)
ID: 3889715 • Letter: M
Question
Most metals weaken as temperature increases. The Ultimate Tensile Strength (UTS) of most metals is accurately predicted by the following equation
where T is the current temperature (degrees Celsius) and EXP is a real number based on the type of metal. UTS is expressed as a value in the range 0.0 to 1.0, where 1.0 means the metal is at full strength, and 0.0 means the metal has no strength whatsoever. You can think of UTS as a percentage: 1.0 = 100%, and 0.0 = 0%.
For example, a particular type of stainless steel has an EXP value of 2.0. When the temperature reaches 300 degrees (Celsius), this type of stainless steel has a UTS of 0.91, or 91%.
Write a complete C++ program that inputs the EXP value for a particular metal (as a real number), and outputs the UTS for the temperatures 100, 200, 300, ..., 1000. Example: given the input value
your program should output
Explanation / Answer
int main()
{
int exp;i;
double s=0,sum=0;
cin >> exp //this is used to accept the uts value from the user
for(i=100;i<=1000;i=i+100) //here, use the loop to calculate different temperatures,consider i started from 100 and //increment by 100,so the variable can be used in the problem.
{
sum=(i/1000)+(i%1000); //to calculate i/1000 i.e,for example,you want 5 divided 2 then (5/2) gives 2 and (5%2) //gives 0.5. So on adding both, you get the desired quotient.
sum=pow(sum,exp); //used to find power of the fucnction
s=(1.0) - sum;
cout i << " : " << s << " "; // this is used to print in the desired format
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.