Question
Temperature problem is to be calculated in .1 degreesteps not 1 plus the completion of the loop needs to bedefined. The velocity of sound in
Temperature problem is to be calculated in .1 degreesteps not 1 plus the completion of the loop needs to bedefined.
The velocity of sound in dry air can be aproximated by the formulavelocity=331.3+0.61 x Tc where TC is the tempature of the air indegrees Celsius and the velocity is in meters/second
Write a program that allows the user to input a starting tempetureand and ending tempeture. Within this tempature range, the programshould output the tempeture and the corrisponding velocity in .1degree increments.
--------------------------------------
For example the program should output
At 1.1 degrees Celsius the velocity of sound is 331.3 m/s.
At 1.2 degrees Celsius the velocity of sound is 331.3 m/s.
//Pg 108 #15 Sound Problem
//
#include
using namespace std;
int main()
{
cout <<"\n***********************************************************************\n";
cout <<"* SoundProblem *";
cout <<"\n***********************************************************************\n";
// Declare Varibles
int temp1, temp2;
int velocity=331.3+0.61;
char n;
//start main program
do {
//get the starting tempeture from the user
cout <<"Enter The StartingTempeture:";
cin >>temp1;
//Get the ending temp from thre user
cout <<"Enter The Ending Tempeture:";
cin >>temp2;
while (temp1 > temp2)
//Do something
// set up formatting
cout.setf(ios::fixed, ios::floatfield);
cout.setf(ios::showpoint);
cout.precision(2);
cout<<"At <
//Ask the user if they want to do anothercalculation
cout << "\nWould you like to enter moretempetures?";
cout <<"\nEnter 'y' for 'Yes' -- 'n' for 'No': ";
cin >> n;
cout <<"\n";
} while (n == 'y' || n == 'Y'); // enddo-while loop
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started