被Курочкин折腾的死去活来之后,我终于决定把他的问题总结一下发上来,权当记录自己的血泪。
本文没什么干货,只是一些新手(可能只有我吧QAQ)容易忽视的问题。
1.
char cByte = -12; // cByte == 0x ?
2.
int iInt = 0xABCDEF98;
unsigned short dd = iInt;// dd == 0x ?
iInt = dd;//iInt == 0x?
short tt = iInt; // tt == 0x?
iInt = tt; //iInt == 0x?
unsigned int aInt = 0xABCDEF98;
short ff = aInt; // ff == 0x?
aInt = ff; // aInt == 0x?
unsigned short gg = aInt; // gg == 0x?
aInt = gg; // aInt == 0x?
3.
float fFloat = 4.2533333f;
double dDouble = 4.2533333;
if (fFloat == dDouble)
dDouble = 999;
stop // dDouble == ?
4.
iInt=1;
double dDouble1=iInt/3.f;
double dDouble2=iInt/3.;
double dDouble3=(float)iInt/ 3;
if (dDouble1 == dDouble2)
dDouble1 = 55;
stop // dDouble1 == ?
iInt=1;
double dDouble1=iInt/2.f;
double dDouble2=iInt/2.;
double dDouble3=(float)iInt/ 2;
if (dDouble1 == dDouble2)
dDouble1 = 55;
stop // dDouble1 == ?
5.
#include <iostream>
int nTwin=1;
namespace TwinSpace{ int nTwin=2;}
main()
{
nTwin=100;
TwinSpace::nTwin = 300;
nTwin++;
int nTwin;
nTwin=200;
::nTwin++;
{
int nTwin;
nTwin=-1;
{int nTwin = 88;
{
nTwin = 99;
}
::nTwin = 44;
{
::nTwin = 91;
}
}
stop // nTwin == ? ::nTwin == ?
::nTwin++;
TwinSpace::nTwin++;
}
nTwin--;
}
6.
for (int i=0; i<3; i++)
{
static int nStatic1 = 100;//
int nLocal1 = 100;
int nLocal2 = i++;
static int nStatic2 = ++nStatic1 * (++i);
nStatic1++;
nStatic2++;
nLocal1++;
stop // i == ?
}
请问总共循环几次,以及全部循环结束后每个值等于多少?
7.
enum eColors
{
BLACK,
BLUE,
GREEN,
RED=5,
YELLOW,
WHITE=RED+4
};
int nnn = BLACK;
nnn = BLUE | YELLOW;// nnn == ?
nnn = BLUE + YELLOW;// nnn == ?
nnn = 1 | 6 & BLACK;// nnn == ?
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦