f0405.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:0k
源码类别:
C#编程
开发平台:
Visual C++
- //=====================================
- // f0405.cpp
- // 显式转换
- //=====================================
- #include<iostream>
- #include<cmath>
- using namespace std;
- //-------------------------------------
- int main(){
- double d = sqrt(123456.0);
- int a = static_cast<int>(d) * 8 + 5;
- int b = d * 8 + 5;
- cout<<d<<endl<<a<<endl<<b<<endl;
- a = 2000000000;
- b = 1000000000;
- int c = (static_cast<double>(a) + b)/2;
- cout<<a+b<<endl<<c<<endl;
- }//====================================