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     float a=3.5,b=2.1,c=0;
     7     cout<<"a="<<a<<"  b="<<b<<"  c="<<c<<endl;
     8 
     9     //与运算
    10     cout<<"a&&b="<<(a&&b)<<endl;//输出1
    11     cout<<"a&&c="<<(a&&c)<<endl;//输出0
    12 
    13     //或运算
    14     cout<<"a||b="<<(a||b)<<endl;//输出1
    15     cout<<"a||c="<<(a||c)<<endl;//输出1
    16 
    17     //非运算
    18     cout<<"!a="<<!a<<endl<<"!c="<<!c<<endl;//输出0  1
    19 
    20     //关系运算和逻辑运算
    21     bool flag=a>=0 && a<=5;  //变量a在[0,5]区间内
    22     cout<<"a=>0 && a<=5="<<flag<<endl;//输出1
    23 
    24     //算术运算、关系运算和逻辑运算
    25     cout<<"a+5>2*b+2||a<b+3="<<(a+5>2*b+2||a<b+3)<<endl;//输出1
    26     return 0;
    27 }
  • 相关阅读:
    vue 根据时间时间区间搜索功能
    vue 分页
    ubuntu18 vscode ros 配置
    在ubuntu16上用vscode编译ros历程记录
    word:页眉头部出现一条横线
    word:设置基偶页不同和页眉页脚
    多级标题
    添加论文应用
    添加论文尾注2(交叉引用)
    三线表
  • 原文地址:https://www.cnblogs.com/borter/p/9406108.html
Copyright © 2011-2022 走看看