SICE Curriculum Portal for Thomas Heffron
Contents

Home
UMKC Curriculum
   FS '96
      CS 101
   SS '01
      CS 201
   FS '01
      CS 191
      CS 281
   WS '02
      CS 291
      EN 304wi
   SS '02
      CS 352
      CS 481
   FS '02
      CS 431
      CS 441
   WS '03
      CS 423
      CS 451
SICE Survival Guide
Personal Experience

contact me @umkc:
tehqnf@umkc.edu

CS431 - Homework #1
 
/*******************************
Name:      Thomas Heffron (tehqnf@umkc.edu)
Section:   CS431 NET
Program:   Assignment #1
Due Date:  Sept. 10, 2002
Desc:      Write a small Linux program to translate
           temperature from C to F.
Inputs:    float value as deg. C
           Continue until Ctrl-D
Outputs:   Float value as deg. F
           Note when end of program
********************************/

#include <iostream>

float toFahr( float Cels ) // External function to calculate deg F
{
     return ((9.0/5.0) * Cels) + 32.0;
}

int main()
{

     // Type Declarations
     float Celsius, Fahrenheit;

     // Quick Display of Usage
     cout << "*** This process will translate your" << endl;
     cout << "*** numerical input in to degrees F." << endl << endl;
     cout << "*** Type CTRL-D when finished." << endl << endl;

     // Prompt to input
     cout << "Enter degrees C: ";

     // Loop until CTRL-D is pressed
     while ( (! cin.eof() ) && cin >> Celsius)
     {
          Fahrenheit = toFahr(Celsius); // Function call

          // Diaplay results and prompt again
          cout << Celsius << " degrees C = " << Fahrenheit << " degrees F" << endl << endl;
          cout << "Enter degrees C: ";
     }

     // Notify at end of program
     cout << endl << endl << "*** END OF PROGRAM ***" << endl << endl;
}