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.

//Kevin Grissom

//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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!