栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

小白的C++问题集(lab1)

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

小白的C++问题集(lab1)

被Курочкин折腾的死去活来之后,我终于决定把他的问题总结一下发上来,权当记录自己的血泪。

本文没什么干货,只是一些新手(可能只有我吧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   
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 == ?
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/232944.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号