Ö°Òµ¼¼ÄÜÌâ¿â&ÔÚÏßÔÆ±ÊÊÔÆ½Ì¨http://www.101test.Com ¼ÆËãÊý×éºÍÖ¸ÕëµÄÄÚ´æÈÝÁ¿ voidFunc(char a[100]) {
cout< 24. [±à³Ì]Àà³ÉÔ±º¯ÊýµÄÖØÔØ¡¢¸²¸ÇºÍÒþ²ØÇø±ð£¿ ²Î¿¼´ð°¸£ºa.³ÉÔ±º¯Êý±»ÖØÔصÄÌØÕ÷£º£¨1£©ÏàͬµÄ·¶Î§£¨ÔÚͬһ¸öÀàÖУ©£»£¨2£©º¯ÊýÃû×ÖÏàͬ£»£¨3£©²ÎÊý²»Í¬£»£¨4£©virtual ¹Ø¼ü×Ö¿ÉÓпÉÎÞ¡£b.¸²¸ÇÊÇÖ¸ÅÉÉúÀຯÊý¸²¸Ç»ùÀຯÊý£¬ÌØÕ÷ÊÇ£º £¨1£©²»Í¬µÄ·¶Î§£¨·Ö±ðλÓÚÅÉÉúÀàÓë»ùÀࣩ£»£¨2£©º¯ÊýÃû×ÖÏàͬ£»£¨3£©²ÎÊýÏàͬ£»£¨4£©»ùÀຯÊý±ØÐëÓÐvirtual ¹Ø¼ü×Ö¡£c.¡°Òþ²Ø¡±ÊÇÖ¸ÅÉÉúÀàµÄº¯ÊýÆÁ±ÎÁËÓëÆäͬÃûµÄ»ùÀຯÊý£¬¹æÔòÈçÏ£º£¨1£©Èç¹ûÅÉÉúÀàµÄº¯ÊýÓë»ùÀàµÄº¯ÊýͬÃû£¬µ«ÊDzÎÊý²»Í¬¡£´Ëʱ£¬²»ÂÛÓÐÎÞvirtual¹Ø¼ü×Ö£¬»ùÀàµÄº¯Êý½«±»Òþ²Ø£¨×¢Òâ±ðÓëÖØÔØ»ìÏý£©¡££¨2£©Èç¹ûÅÉÉúÀàµÄº¯ÊýÓë»ùÀàµÄº¯ÊýͬÃû£¬²¢ÇÒ²ÎÊýÒ²Ïàͬ£¬µ«ÊÇ»ùÀຯÊýûÓÐvirtual ¹Ø¼ü×Ö¡£´Ëʱ£¬»ùÀàµÄº¯Êý±»Òþ²Ø£¨×¢Òâ±ðÓ븲¸Ç»ìÏý£© 25. [±à³Ì] 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 26. [±à³Ì] ÈçºÎ´òÓ¡³öµ±Ç°Ô´ÎļþµÄÎļþÃûÒÔ¼°Ô´ÎļþµÄµ±Ç°Ðкţ¿ ²Î¿¼´ð°¸£ºcout<< __FILE__ ;cout<<__LINE__ ;__FILE__ºÍ__LINE__ÊÇϵͳԤ¶¨Òåºê£¬ÕâÖֺ겢²»ÊÇÔÚij¸öÎļþÖж¨ÒåµÄ£¬¶øÊÇÓɱàÒëÆ÷¶¨ÒåµÄ¡£ µÚ9Ò³ Ö°Òµ¼¼ÄÜÌâ¿â&ÔÚÏßÔÆ±ÊÊÔÆ½Ì¨http://www.101test.Com 27. [±à³Ì] mainÖ÷º¯ÊýÖ´ÐÐÍê±Ïºó£¬ÊÇ·ñ¿ÉÄÜ»áÔÙÖ´ÐÐÒ»¶Î´úÂ룬¸ø³ö˵Ã÷£¿ ²Î¿¼´ð°¸£º¿ÉÒÔ£¬¿ÉÒÔÓÃ_onexit×¢²áÒ»¸öº¯Êý£¬Ëü»áÔÚmain Ö®ºóÖ´ÐÐintfn1(void), fn2(void), fn3(void), fn4 (void); void main( void ) { String str(\_onexit( fn1 ); _onexit( fn2 ); _onexit(fn3 ); _onexit( fn4 ); printf( \} int fn1() { printf( \return 0; } int fn2() { printf( \return 0; µÚ10Ò³ Ö°Òµ¼¼ÄÜÌâ¿â&ÔÚÏßÔÆ±ÊÊÔÆ½Ì¨http://www.101test.Com } int fn3() { printf( \return 0; } int fn4() { printf( \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. 28. [±à³Ì] ÈçºÎÅжÏÒ»¶Î³ÌÐòÊÇÓÉC ±àÒë³ÌÐò»¹ÊÇÓÉC++±àÒë³ÌÐò±àÒëµÄ£¿ ²Î¿¼´ð°¸£º#ifdef __cplusplus cout<<\#else cout<<\#endif 29. [±à³Ì]ÎļþÖÐÓÐÒ»×éÕûÊý£¬ÒªÇóÅÅÐòºóÊä³öµ½ÁíÒ»¸öÎļþÖÐ µÚ11Ò³ Ö°Òµ¼¼ÄÜÌâ¿â&ÔÚÏßÔÆ±ÊÊÔÆ½Ì¨http://www.101test.Com ²Î¿¼´ð°¸£º££include££includeusing namespace std;void Order(vector& data)//bubble sort { int count = data.size() ; int tag = false ; //ÉèÖÃÊÇ·ñÐèÒª¼ÌÐøÃ°Åݵıê־λ for ( inti = 0 ; i< count ; i++) { for ( int j =0 ; j < count - i - 1 ; j++) { if ( data[j] > data[j+1]) { tag = true ; int temp = data[j] ; data[j] = data[j+1] ; data[j+1] = temp ; } } if ( !tag ) break ; } } void main( void ) µÚ12Ò³