UTS 1.0- (T/1000)^EXP = where T is the current temperature (degrees Celsius) and
ID: 3889886 • Letter: U
Question
UTS 1.0- (T/1000)^EXP = 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 2.0 your program should output 100: 0.99 200: 0.96 300: 0.91 400: 0.84 500: 0.75 600: 0.64 700: 0.51 800: 0.36 900: 0.19 1000: 0Explanation / Answer
C++ code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> temperatures;
temperatures.push_back(100);temperatures.push_back(200);temperatures.push_back(300);temperatures.push_back(400);
temperatures.push_back(500);temperatures.push_back(600);temperatures.push_back(700);temperatures.push_back(800);
temperatures.push_back(900);temperatures.push_back(1000);
cout << "Enter the value of EXP ";
double EXP ;
cin >> EXP;
for (int i = 0; i < temperatures.size(); ++i)
{
cout << temperatures[i] << ": " << (1.0 - pow( (temperatures[i]/1000.0), EXP)) << endl;
}
return 0;
}
Sample Output:
Enter the value of EXP
2.0
100: 0.99
200: 0.96
300: 0.91
400: 0.84
500: 0.75
600: 0.64
700: 0.51
800: 0.36
900: 0.19
1000: 0
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.