//
//  main.cpp
//
//  Created by Robert Metcalfe on 5/03/2014.
//  Copyright (c) 2014 Robert Metcalfe. All rights reserved.
//
//  cout_formatting
//  Format a logarithmic table to standard output via std::cout and ...
//   Also use: std::cout.precision([numberSignificantNumbers]) ... setw([colWidth]) ... endl

#include <iostream>
#include <iomanip>
#include "math.h"

int main() {
    int rows, columns, n, i, j;
    double base1 = 7.0, base2;
    std::cout << "Log values program" << std::endl << std::endl;
    std::cout << "Enter start logarithm value: ";
    std::cin >> base2;
    std::cout << "Enter how many logarithm values: ";
    std::cin >> rows;
    std::cout << "Enter start base value: ";
    std::cin >> base1;
    std::cout << "Enter how many base values: " ;
    std::cin >> columns;
    std::cout << "Enter precision (number of significant numbers): ";
    std::cin >> n;
    std::cout.precision(n);
    std::cout << std::endl << std::endl << "Table starts at logarithm of b = " << base2 << " with base a = " << base1 << std::endl;
    std::cout << "Log values ";
    for( j=0; j<rows; j++) std::cout << std::setw(8) << " b + " << j;
    std::cout << std::endl;
    for( i=0; i<columns; i++) {
        std::cout << "     a + " << i << " ";
        for( j=0; j<rows; j++) {
            std::cout << std::setw(8) << (log(base2+j)/log(base1+i)) << " ";
        }
        std::cout << std::endl;
    }
    return 0;
}





