LAB EXERCISE - 6.1 FUN 

Assignment:

 1.    The two temperature scales used in the United States are Celsius and Fahrenheit.  The mathematical relationship between the two scales is:

             C =  5/9 (F - 32)

       Write two functions, fToC and cToF, which convert temperatures from one scale to another.  For example, a call of fToC will return the equivalent Celsius temperature for a given Fahrenheit temperature.

             Celsius = fToC (100);    // Celsius now stores 37.8

2.    Write a function which takes in the radius of a sphere and returns its volume.  The formula is:

             V = 4/3 - r3

       You are encouraged to use a constant for the value of _.

3.    Write a function which returns the hypotenuse of a right triangle given the input of the two smaller sides.  Use the Pythagorean theorem:

             a2 + b2 = c2

Instructions:

1.    Round off all floating point values to two decimal places (0.01).

2.    Remember to write function prototypes for all four of your functions.

3.    You can use the following format of a cout statement to test your program:

       cout << "212 degrees F ---> " << fToC (212) << " degrees C" << endl;

       function main could be written using only 11 function calls.

4.    Use the following values to test your functions:

       Fahrenheit to Celsius:   212oF, 98.6oF, 10oF

       Celsius to Fahrenheit:   -15oC, 0oC, 70oC

       Volume of a sphere, radius of:  1.0, 2.25, 7.50

       Hypotenuse calculations:  sides of 3.0 and 4.0,  sides of 6.75 and 12.31

5. Template- fill in missing parts: Note that functions are required on this and all future programs.

//Your Name Lesson 6.1 P#9
//Function Lab Exercise
//Template- fill in missing parts:


#include<  .h>
#include<  .h>
#include<  .h>

const      PI =    ;

double ctoF(    );  //prototypes require type of function and parameter passed type
double volume(   );
double hypotenuse (   );
double ftoC(   );

int main()

{
     double [declare variable names];
     intro();  //function call
     cout<<"Enter a Celsius temperature to be converted to Fahrenheit"<<endl;
     cin>>celsius;
     cout<<"Enter a Fahrenheit temperature to be converted to Celsius"<<endl;
     cin>>fahr;
     cout<<"Enter the radius of the sphere"<<endl;
     cin>>sphere;
     cout<<"Enter the legs of the right triangle leaving a space between them"<<endl;
     cin>>firstleg>>secondleg;

     cout <<setiosflags(ios::right|ios::fixed|ios::showpoint);
     cout <<setprecision(2);
     cout << [fill in  here] <<endl;
     cout << [fill in here] <<endl;
     cout <<"The volume of a sphere of radius " << [fill in here] <<endl;
     cout <<"The hypotenuse of a right triangle of legs "<<  [fill in here] <<endl;

}

int intro( )
{
     cout << "Program              ";
     cout << "By Your Name on October 5, 2000. ";
     cout << endl;
     cout << "This program bla bla bla \n ";
     cout << "bla bla bla \n";
     cout << "bla bla bla."; 
     cout << endl;
     cout << endl;
}

double ctoF(          )
{
        return (          );
}

double ftoC(             )
{
       return (         );
}

double volume(       )
{
      return (               );
}

double hypotenuse (       )
{
      return          (                    );
}