国产高潮人妖99视频_国产精品九九九国产盗摄蜜臀_国产一区二区天天看片_国产精品无码AV无码_不卡的av帝国在线一区二区

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

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

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

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. 如何打印出當(dāng)前源文件的文件名以及源文件的當(dāng)前行號(hào)?

答案:

cout << __FILE__ ;

cout<<__LINE__ ;

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

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

答案:可以,可以用_onexit 注冊(cè)一個(gè)函數(shù),它會(huì)在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)
已有條評(píng)論
新聞瀏覽排行