Category : C++ Source Code
Archive   : JCOOL01.ZIP
Filename : EX3_8.C

 
Output of file : EX3_8.C contained in archive : JCOOL01.ZIP
//
// Copyright (C) 1991 Texas Instruments Incorporated.
//
// Permission is granted to any individual or institution to use, copy, modify,
// and distribute this software, provided that this complete copyright and
// permission notice is maintained, intact, in all copies and supporting
// documentation.
//
// Texas Instruments Incorporated provides this software "as is" without
// express or implied warranty.
//

#include // Include COOL Rational class

int main (void) {
CoolRational r1 (10,3); // Create CoolRational object
CoolRational r2 (-4,27), r3; // Create CoolRational objects
r3 = r1 + r2; // Calculate sum of values
cout << r1 << " + " << r2 << " = " << r3 << "\n"; // And display result
r3 = r1 * r2; // Calculate product of values
cout << r1 << " * " << r2 << " = " << r3 << "\n"; // And display result
r3 = r1 / r2; // Calculate quotient of values
cout << r1 << " / " << r2 << " = " << r3 << "\n"; // And display result
r3 = r1 % r2; // Calculate remainder of values
cout << r1 << " % " << r2 << " = " << r3 << "\n"; // And display result

double d1 = double (10.0 / 3.0); // Create double ratio
double d2 = double (-4.0 / 27.0), d3; // Create double ratios
d3 = d1 + d2; // Calculate sum of values
cout << d1 << " + " << d2 << " = " << d3 << "\n"; // And display result
d3 = d1 * d2; // Calculate product of values
cout << d1 << " * " << d2 << " = " << d3 << "\n"; // And display result
d3 = d1 / d2; // Calculate quotient of values
cout << d1 << " / " << d2 << " = " << d3 << "\n"; // And display result
return 0; // Return valid success code
}


  3 Responses to “Category : C++ Source Code
Archive   : JCOOL01.ZIP
Filename : EX3_8.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/