Mega Code Archive

 
Categories / C++ / Console
 

Create a table of log10 and log from 2 through 100

#include <iostream> #include <cmath> using namespace std; int main() {   double x;   cout.precision(5);   cout << "         x       log x        ln e\n\n";   for(x = 2.0; x <= 100.0; x++) {     cout.width(10);     cout << x << "  ";     cout.width(10);     cout << log10(x) << "  ";     cout.width(10);     cout << log(x) << '\n';   }     return 0; }