course.wilkes.edu/CS125Labs
Welcome to the site for CS 125 labs!

 

pierre2.cpp

Prev | Next | Lab 10

// pierre2.cpp solves chef Pierre's fraction multiplication problem
//  using a Fraction class and overloaded I/O operators.
//
//  Author: Joel C. Adams, for Hands On C++.
//  Date: April 1994.
//  Revised: October 1997.
//
//  Input: Two Fraction values.
//  Precondition: Neither Fraction has a denominator of zero.
//  Output: The product of the two Fractions.
//**********************************************************

#include <iostream> using namespace std;

#include "Fraction.h"

int main() { Fraction oldMeasure; Fraction scaleFactor(1,6); Fraction newMeasure;

cout << endl << "To convert fractional measures," << endl; cout << " enter the fractional measure you want to convert: "; // cin >> oldMeasure;

cout << endl << "Enter the fractional amount to reduce/increase it by: "; // cin >> scaleFactor;

newMeasure = oldMeasure * scaleFactor;

cout << endl << "The fractional measurement is: "; // cout << oldMeasure; cout << endl << endl;

cout << endl << "The fractional amount is: "; // cout << scaleFactor; cout << endl << endl;

// cout << "\nThe converted measurement is: " << newMeasure << endl << endl; }

Prev | Next | Lab 10

 
  Home

Help

Lab 0

Lab 1

Lab 2

Lab 3a

Lab 3b

Lab 4

Lab 5

Lab 6

Lab 7

Lab 8

Lab 9

Lab 10

Lab 11

Lab 12

Lab 13



Membership

Login




Last update: Tuesday, November 13, 2001 at 9:51:44 AM.
visitors to this page.