Using namespace std; The expansion of a steel bridge as it heated to a final Cel
ID: 3801075 • Letter: U
Question
Using namespace std;
The expansion of a steel bridge as it heated to a final Celsius temperature, Tf, from an initial temperature T0 , can be approximated using the following formula:
Increase in length= a* L*(Tf-T0). Where a is the coefficient of expansion that is for steel is 11.7e-6, L is the length of bridge at temperature T0.
Using this formula, write a C++ program that displays a table of expansion length for a steel bridge that’s 7365 meters long at 0 degrees Celsius, as the temperature increases to 40 degrees in 5 degree increments.
Explanation / Answer
#include <bits/stdc++.h>
using namespace std;
float Length(int Tf)
{
const float a = 11.7E-6;
const float L = 7365;
const float To=0;
return a*L*(Tf-To);
}
int main(int argc, char const *argv[])
{
cout<<"Intitial Temperature Final Temperature Increased Length ";
for (int i=1;i<=8;i++)
cout<<0<<" degrees "<<i*5<<" degrees "<<Length(i*5)<<endl;
return 0;
}
=====================================================
Output:
akshay@akshay-Inspiron-3537:~/Chegg$ g++ three.cpp
akshay@akshay-Inspiron-3537:~/Chegg$ ./a.out
Intitial Temperature Final Temperature Increased Length
0 degrees 5 degrees 0.430853
0 degrees 10 degrees 0.861705
0 degrees 15 degrees 1.29256
0 degrees 20 degrees 1.72341
0 degrees 25 degrees 2.15426
0 degrees 30 degrees 2.58511
0 degrees 35 degrees 3.01597
0 degrees 40 degrees 3.44682
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.