书籍名称:C++ Primer Plus(中文第五版)
错误说明:程序2.4 缺少赋值语句
- // sqrt.cpp--using the sqrt() function
- #include <iostream>
- #include <cmath>
- 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
- <<" feet to the side."<<endl;
- cout<<"How fascinating!"<<endl;
- system("pause");
- return 0;
- }
T14缺少“"<<side”
本文介绍了一个使用 C++ 进行平方根计算的简单程序案例,该程序存在缺少输出变量值的问题,旨在帮助读者理解 C++ 的基本语法和 sqrt 函数的用法。
739

被折叠的 条评论
为什么被折叠?



