This program will print out the logarithm of a number to a given base. Your prog
ID: 3637618 • Letter: T
Question
This program will print out the logarithm of a number to a given base. Your program should read two numbers from standard input:1. The first number is a positive floating point number for which your program will compute the logarithm.
2. The second number is a positive floating point number that represents the base to which the logarithm will be taken.
See page 93 in your book for a description of how to compute a logarithm to a particular base.
Your program should emit appropriate prompts and also include a description with its output. Shown below are two example runs, showing input and output.
should look like this
http://s52.photobucket.com/albums/g15/breakdancer122/?action=view¤t=do.jpg
this is what my stupid attempt looks like;
/*--------------------------------------------------------------------------*/
/* */
/* */
/* */
/* */
/* Author Lester Dela Cruz */
/* B19c - Jan 25, 2012 */
/* pp2_21.cpp */
#include <iostream> //Required for cout, endl.
#include <iomanip> //Required for setw() setprecision(), fixed.
#include <cmath> //Required for acos().
using namespace std;
const double ln(x), ln(b);
int main()
{
// Declare and initialize objects.
double x, b;
logb(x) = ln(x)/ln(b);
// Output on the screen
cout << "Enter a positive number: " << endl;
cin >> x;
//Output on the screen base
cout << "Enter a base: " << endl;
cin >> b;
//Output on the screen logb(x)
cout << x << "log of " << b << "is " << logb(x) << endl;
// Exit program
return 0;
}