- 程序来源:C++ primer plus
- 程序名称:assign.cpp
- 章 节:3.13
- 作 者:tiaya@qq.com
- 运行测试:通过
/********************************
* 程序来源:C++ primer plus
* 程序名称:assign.cpp
* 章 节:3.13
* 作 者:tiaya@qq.com
* 运行测试:通过
*******************************/
//#include <bits/stdc++.h> //万能头文件,不建议使用
#include <iostream>
int main() {
using namespace std;
cout.setf(ios_base::fixed, ios_base::floatfield);
float tree = 3; //int to float
int guess(3.982); //double to int
//int debt = 7.2E12; //result not defined in c++ //ERRor
cout << "tree=" << tree << endl;
cout << "guess=" << guess <<endl;
//cout << "debt=" << debt <<endl;
return 0;
}
输出结果:
tree=3.000000
guess=3
--------------------------------
Process exited after 0.5863 seconds with return value 0
请按任意键继续. . .
网友评论