// This program is to show the basics of the cmath library // // Written by: Pat Troy // For: CS 107 // Date: 1/27/2203 /************************************************************* * This program is to show the basics of the cmath library * * * * Written by: Pat Troy * * For: CS 107 * * Date: 1/27/2203 * *************************************************************/ #include #include using namespace std; main() { float val1 = 1, val2 =2, val3(3); float val4, val5; cout << "Welcome" << endl << endl; val4 = val4 * val2; cout << "val1: " << val1 << endl; cout << "val2: " << val2 << endl; cout << "val3: " << val3 << endl; cout << "val4: " << val4 << endl; cout << "val5: " << val5 << endl; cout << endl; // prompt for and get the first value cout << "Enter in a value: "; cin >> val1; // prompt for and get the second value cout << "Enter in another value: "; cin >> val2; cout << "The values entered were " << val1 << " and " << val2 << endl; // Use the square root function from the cmath library val3 = sqrt (val1); val4 = sqrt (val2); // Use the power function from the cmath library // - raise val1 to the power of val2 val5 = pow (val1, val2); cout << "val1: " << val1 << endl; cout << "val2: " << val2 << endl; cout << "val3: " << val3 << endl; cout << "val4: " << val4 << endl; cout << "val5: " << val5 << endl; cout << endl; cout << endl << "Goodbye" << endl; }