程序清单2.4 sqrt.cpp

// sqrt.cpp -- using the sqrt() function

#include <iostream>
#include <cmath>   // or math.h

int main()
{
    using namespace  std;

    double area;
    cout << "Enter the floor area, in square feet, of your home:";
    cin >> area;

    double side;
    side = sqrt(area);

    cout << "That's the equivalent of a square " << side
         << " feet to the side." << endl;
    cout << "How fascinating!" << endl;

    return 0;
}

猜你喜欢

转载自blog.csdn.net/m0_38101326/article/details/88043762
cpp