//libr-fns.cpp //how to call functions in the standard libraries #include #include //for rand() #include //for floor(), pow() using namespace std; const double PI = 3.14159; int main(){ double x1 = 2.0, x2 = 3.0, x3; cout << showpoint << 1234.56789 << endl << rand() % 6 + 1 << endl; cout << pow(2.0, 3.0) << endl //args are constants << pow(x1, x2) << endl //args are variables << pow(x1 * 2.0, x2 - 1) << endl //args are expressions << pow(x1, floor(PI)) << endl //args are expressions << pow(pow(x1, x2), floor(PI) - 1) //args are expressions << endl; //using library functions in assignment statement x3 = 2 * (pow(floor(PI), (rand() % 6 + 1))); cout << x3 << endl; cout << "Exiting.." << endl; return 0; }