SOURCE FILE: 020_firstSampProg_B.cpp



/* 
   This program inputs the cost of a product and its weight in ounces, and
   then calculates and outputs the cost per ounce of the product.

   This version of the program uses one less variable.  See how it works?
*/

#include <iostream>
using namespace std ;

int main (void)
{
   double cost ;
   double weight ;

   cout << endl ;
   cout << "Please enter the cost of the product (fixed decimal format): " ;
   
   cin >> cost ;

   cout << "Please enter the net weight of the product\n" ;
   cout << "in ounces (positive number, fixed decimal format): " ;
   
   cin >> weight ;

   cout << "When the cost is " << cost << " and the weight is " 
        << weight << endl ;
   cout << "the cost per ounce is: " ;
   cout << (cost / weight)  ;
   cout << ".\n\n" ;

   return 0;
}