????11.??8086 ????£?????????????????????????????Intel??
??????????ü??????????????????????????????μ???????*10H+??ü?????????????????????????????
????12.???д??BOOL??int??float?????????????a ??“??”???????
????????
????BOOL : ??   if ( !a ) or if(a)
????int : ??  ??  if ( a == 0)
????float :        const EXPRESSION EXP = 0.000001
????if ( a < EXP&& a >-EXP)
????pointer :?? if ( a != NULL) or if(a == NULL)
????13.?????const??#define ?????к????
????1?? const ??????????????????????????????????????????????????????????顣????????????????滻?????????????飬??????????滻????????????????????
????2?? ??Щ?????????????????const ???????е??????????????????е????
????14.??????????????????
???????????????洢??????????????????飩????????????????????????????????????????顣
????(1)????????????
????char a[] = “hello”;
????a[0] = ‘X’;
????char *p = “world”; // ???p ??????????
????p[0] = ‘X’; // ??????????????????????????
??????????????????д char c = 'x'; p = &c;?????????????
????(2) ???????sizeof ????????????????????????????sizeof(p)??p ??????????????????????????????????p ??????????????C++/C ??????а????????????????????????????????????????????????????????????????д????????????????????????????
????char a[] ="hello world";
????char*p = a;
????cout<<sizeof(a) << endl; // 12 ???
????cout<<sizeof(p) << endl; // 4 ???
????????????????????????
????void Func(char a[100])
????{
????cout<<sizeof(a) << endl; // 4 ????????100 ???
????}
????15.????????????????????????????
????????
????a.????????????????????
??????1????????Χ???????????У???
??????2???????????????
??????3???????????
??????4??virtual ???????п????
????b.?????????????????????????????????
??????1????????Χ?????λ???????????????
??????2???????????????
??????3???????????
??????4??????????????virtual ??????
????c.“????”??????????????????????????????????????????£?
??????1??????????????????????????????????????????????????????virtual????????????????????????????????????????
??????2??????????????????????????????????????????????????????virtual ???????????????????????????????????????
????16.There are twoint variables: a and b?? don’t use “if”?? “? :”?? “switch”or other judgementstatements?? find out the biggest one of the two numbers.
???????????????????????????
????????( ( a + b ) + abs( a- b ) ) / 2
????17.??δ??????????????????????????????к??
????????
????cout << __FILE__ ;
????cout<<__LINE__ ;
????__FILE__??__LINE__????????????????????????????ж?????????????????????
????18.????ж???γ???????C ???????????C++????????????
????????
????#ifdef __cplusplus
????cout<<"c++";
????#else
????cout<<"c";
????#endif
????19.
????main ???????????????????????????δ????????????
???????????????????_onexit ??????????????????main ??????int fn1(void)?? fn2(void)?? fn3(void)??fn4 (void);
void main( void )
{
String str("zhanglin");
_onexit( fn1 );
_onexit( fn2 );
_onexit( fn3 );
_onexit( fn4 );
printf( "This is executed first. " );
}
int fn1()
{
printf( "next. " );
return0;
}
int fn2()
{
printf( "executed " );
return0;
}
int fn3()
{
printf( "is " );
return0;
}
int fn4()
{
printf( "This " );
return0;
}
The _onexit function is passed the address of a function (func) to be called whenthe program terminates normally. Successive calls to _onexit create a registerof functions that are executed in LIFO (last-in-first-out) order. The functionspassed to _onexit cannot take parameters.
?????????This is executed next.