/*---------------------------------------------------------------------+ | Copyright (c) 1995, SAS Institute Inc. | | Unpublished - All Rights Reserved | | S A S / C S A M P L E | | | | | | NAME: FTOC | | LANGUAGE: C++ | | PURPOSE: Create a Farenheit to Celsius conversion table. | | MVS - | | COMPILE: Compile using LCXX. | | LINK: Linked using LCXXL. | | EXECUTE: Call .LOAD(FTOC). | | NOTES: | | TSO - | | COMPILE: Compile using LCXX. | | LINK: Link using COOL with "CXX" option. | | EXECUTE: Call .LOAD(FTOC). | | NOTES: | | CMS - | | COMPILE: Compile using LC370C for C, LCXX for C++. | | LINK: Link using COOL with "CXX" option. | | EXECUTE: Call FTOC. | | NOTES: | | | +---------------------------------------------------------------------*/ #include #include void main() { int lower, upper, step; lower = 0; // lower limit of temperature table upper = 300; // upper limit step = 20; // step size // set output format state cout.setf( ios::fixed , ios::floatfield ); cout.precision( 1 ); for( int fahr = lower; fahr <= upper; fahr += step ) { float celsius = (5.0/9.0) * (fahr-32.0); cout << setw(4) << fahr << " " << setw(5) << celsius << endl; } return; }