zoukankan      html  css  js  c++  java
  • 共性规则

    共性规则

    本节论述的共性规则是被大多数程序员采纳的,我们应当在遵循这些共性规则的前 提下,再扩充特定的规则。

     1 #include <iostream>
     2 
     3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
     4 using namespace std;
     5 int main(int argc, char** argv) {
     6        //测试表达式类型的转换
     7     int n=100,m;
     8     double x=3.791,y;
     9     cout<<"n*x="<<n*x<<endl;
    10     
    11     //赋值类型转换
    12     m=x;
    13     y=n;
    14     cout<<"m="<<m<<endl;
    15     cout<<"y="<<y<<endl;
    16 
    17     //强制类型转换
    18     cout<<"int(x)="<<int(x)<<endl;
    19     cout<<"(int)x="<<(int)x<<endl;
    20     cout<<"int(1.732+x)="<<int(1.732+x)<<endl;
    21     cout<<"(int)1.732+x="<<(int)1.723+x<<endl;
    22     cout<<"double(100)="<<double(100)<<endl;
    23     return 0;
    24 }
  • 相关阅读:
    走进Android系统
    最后的一像素。
    rem介绍
    软件安装相关问题。
    iscroll
    程序员常用词语发音
    一个程序员眼中的好UI
    myeclipse性能优化
    注入配置数据
    java IO
  • 原文地址:https://www.cnblogs.com/borter/p/9406192.html
Copyright © 2011-2022 走看看