#include <iostream> #include <cmath> #include <cstdlib> using namespace std; int main() { double w, x, y, b, c, d, expo, sr, absolute_double, ceiling, fl; int a, z, absolute; long abs_long; cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(1); cout << "Enter the values of the following : \n" << "-------------------------------\n" << "pow(x, y)\n" << "x: "; cin >> x; cout << "y: "; cin >> y; cout << "sqrt(w)\n" << "w: "; cin >> w; cout << "abs(z)\n" << "z: "; cin >> z; cout << "labs(a)\n" << "a: "; cin >> a; cout << "fabs(b)\n" << "b: "; cin >> b; cout << "ceil(c)\n" << "c: "; cin >> c; cout << "floor(d)\n" << "d: "; cin >> d; expo = pow(x, y); cout << "___________________________\n" << "pow(x, y) = pow(" << x << ", " << y << ") "<< " = " << expo << endl; sr = sqrt(w); cout << "sqrt(w) = sqrt(" << w << ") "<< " = " << sr << endl; absolute = abs(z); cout << "abs(z) = abs(" << z << ") "<< " = " << absolute << endl; abs_long = labs(a); cout << "labs(a) = labs(" << a << ") "<< " = " << abs_long << endl; absolute_double = fabs(b); cout << "fabs(b) = fabs(" << b << ") "<< " = " << absolute_double << endl; ceiling = ceil(c); cout << "ceil(c) = ceil(" << c << ") "<< " = " << ceiling << endl; fl = floor(d); cout << "floor(d) = floor(" << d << ") "<< " = " << fl << endl; return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter