源代码为
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
const double Cost = 10.50;
double budget, area, lengthSide;
cout << "Enter the amount please.";
cin >> budget;
area = budget/Cost;
lengthSide = sqrt(area);
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout << "for a price of $" << budget << endl
<< "I can built you a doghouse" << "that is" << lengthSide
<< "feet";
return 0;
}
代码中有段:
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
哪位高手解释一下啊,多谢了。
[此贴子已经被作者于2007-7-27 10:19:33编辑过]