zoukankan      html  css  js  c++  java
  • 复合表达式

    复合表达式

    如 a = b = c = 0 这样的表达式称为复合表达式。允许复合表达式存在的理由是:

    (1) 书写简洁;

    (2)可以提高编译效率。但要防止滥用复合表达式。

     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     int x,y;
     7     cout<<"x=";
     8     cin>>x;
     9     if (x<=0) {            //满足条件执行
    10        y=2*x; 
    11        cout<<"y="<<y;     //输出结果
    12     }
    13     else  {              //不满足条件执行
    14        y=x*x; 
    15        cout<<"y="<<y;    //输出结果
    16     }
    17     return 0;
    18 }
  • 相关阅读:
    I/O流
    课堂测试
    1021课堂内容
    课堂jsp
    课堂动手动脑
    从小工到专家读后感
    课堂测试2
    回文课堂测试
    一周进度条博客
    Echart图表
  • 原文地址:https://www.cnblogs.com/borter/p/9406224.html
Copyright © 2011-2022 走看看