值x和y的屏幕

来源:互联网 发布:java面试题2016 编辑:程序博客网 时间:2024/05/21 11:29

这是常见的括号的表达条件部分以使它更容易阅读确定优先是正确的

记住:算子具有非常低的优先级。如果做的比其他任何使用导致一个赋值语句具有更低的优先级吗?声明需要括号

例如,要打印的值x和y屏幕更大我们

以这样做


1
2
3
4
if(x > y)
    cout << x;
else
    cout << y;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
 
intmain()
{
    usingnamespace std;
    cout << "bool:\t\t"<< sizeof(bool) << " bytes" << endl;
    cout << "char:\t\t"<< sizeof(char) << " bytes" << endl;
    cout << "wchar_t:\t"<< sizeof(wchar_t) << " bytes" << endl;
    cout << "short:\t\t"<< sizeof(short) << " bytes" << endl;
    cout << "int:\t\t"<< sizeof(int) << " bytes" << endl;
    cout << "long:\t\t"<< sizeof(long) << " bytes" << endl;
    cout << "float:\t\t"<< sizeof(float) << " bytes" << endl;
    cout << "double:\t\t"<< sizeof(double) << " bytes" << endl;
    cout << "long double:\t" << sizeof(longdouble) << " bytes" << endl;
    return0;

尽管我们已经谈到了sizeof运算符,我们将再简要的完整性。sizeof操作符返回字节大小类型或变量

你可以编译并运行下面的程序来找出你有多大的数据类型


0 0
原创粉丝点击