国产女人大黑β片在线观看_国产成人亚洲精品无码Av大片l_亚洲成人无码手机播放_强奸暴虐视频在线观看

您當前位置: 唯學(xué)網(wǎng) » IT認證培訓(xùn) » 真題專題

Java認證考試筆試真題精選(4)

來源:唯學(xué)網(wǎng)•教育培訓(xùn)(www.career2zoom.com)  【唯學(xué)網(wǎng) • 中國教育電子商務(wù)平臺】 加入收藏

5. There are two int variables: a and b, don’t use “if”, “? :”, “switch”orother judgement statements, find out the biggest one of the two numbers.

答案:( ( a + b ) + abs( a - b ) ) / 2 6. 如何打印出當前源文件的文件名以及源文件的當前行號?

答案:

cout << __FILE__ ;

cout<<__LINE__ ;

__FILE__和__LINE__是系統(tǒng)預(yù)定義宏,這種宏并不是在某個文件中定義的,而是由編譯器定義的。

7. main主函數(shù)執(zhí)行完畢后,是否可能會再執(zhí)行一段代碼,給出說明?

答案:可以,可以用_onexit 注冊一個函數(shù),它會在main 之后執(zhí)行intfn1(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.\n" );

}

int fn1()

{

printf( "next.\n" );

return 0;

}

int fn2()

{

printf( "executed " );

return 0;

}

int fn3()

{

printf( "is " );

return 0;

}

int fn4()

{

printf( "This ");

return 0;

}

The _onexit function is passed the address of afunction (func) to be called when the program terminates normally. Successivecalls to _onexit create a register of functions that are executed in LIFO(last-in-first-out) order. The functions passed to _onexit cannot takeparameters.

8. 如何判斷一段程序是由C 編譯程序還是由C++編譯程序編譯的?

答案:

#ifdef __cplusplus

cout<<"c++";

#else

cout<<"c";

#endif

0% (0)
0% (10)
已有條評論
新聞瀏覽排行