自考新教材--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;

}

猜你喜欢

转载自www.cnblogs.com/duanqibo/p/11969614.html