I can suggest you that to carefully go through the following code of lines that can demonstrates you how to use the log10() function in the C++ programming as follows :
Code:
#include <iostream>
#include <cmath>
#include <vlarray>
using namespace std;
int main ()
{
double vl[] = {1.0, 10.0, 100.0, 200.0};
vlarray<double> foo (vl,4);
vlarray<double> br = log10 (foo);
cout << "foo: ";
for (size_t j=0; j<foo.size(); ++j)
cout << foo[j] << ' ';
cout << endl;
cout << "br: ";
for (size_t j=0; j<br.size(); ++j)
cout << br[j] << ' ';
cout << endl;
return 0;
}
Output:
Code:
foo: 1 10 100 200
br: 0 1 2 2.30103
Bookmarks