自考新教材--p40

源程序:   各种数据类型的转换

#include <iostream>

using namespace std;

int main()

{

const int cInt = 30;

int oneInt = 50;

int &ref = oneInt;

const int &rc1 = cInt;

const int &rc2 = oneInt;

const int &rc3 = ref;

int dInt = ref;

int eInt = cInt;

int fInt = rc1;

const int gInt = oneInt;

int &ref1 = ref;

const int hInt = ref;

const int jInt = cInt;

const int &mInt = rc1;

const int nInt = rc2;

cout << "OK" << endl;

int &r2 = (int &)rc1;

int &r3 = (int &)cInt;

system("pause");

return 0;

}

posted @ 2019-12-02 11:29  bobo哥  阅读(103)  评论(0编辑  收藏  举报