锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久婷婷五月综合色99啪ak,91精品国产高清久久久久久io,久久精品国产亚洲αv忘忧草http://www.shnenglu.com/Marcky/category/10941.htmlMy Email: marckywu@gmail.comzh-cnThu, 20 Aug 2009 11:33:25 GMTThu, 20 Aug 2009 11:33:25 GMT60瀹夊叏璁塊棶鏁扮粍鐨勬寚閽堢被妯℃澘http://www.shnenglu.com/Marcky/archive/2009/08/13/93233.htmlMarckyMarckyThu, 13 Aug 2009 10:29:00 GMThttp://www.shnenglu.com/Marcky/archive/2009/08/13/93233.htmlhttp://www.shnenglu.com/Marcky/comments/93233.htmlhttp://www.shnenglu.com/Marcky/archive/2009/08/13/93233.html#Feedback0http://www.shnenglu.com/Marcky/comments/commentRss/93233.htmlhttp://www.shnenglu.com/Marcky/services/trackbacks/93233.html
#include <iostream>
#include 
<stdexcept>

using namespace std;

template
<typename T>
class Ptr2T {
public:
//鏋勯犲嚱鏁幫紝褰㈠弬涓烘暟緇勮搗濮嬪湴鍧鍜屽ぇ灝?/span>
    Ptr2T(T *p, int size)
        : m_p(p), m_array(p), m_size(size) { };

    Ptr2T
& operator++();                //鍓嶇紑++
    const Ptr2T operator++(int);        //鍚庣紑++

    Ptr2T
& operator--();                //鍓嶇紑--
    const Ptr2T operator--(int);        //鍚庣紑--

    Ptr2T
& operator+=(int n);
    Ptr2T
& operator -=(int n);
//瀹夊叏鐨勬暟緇勫厓绱犺闂搷浣?/span>
    T& operator*() const;  
private:
    T 
*m_p;           //璁塊棶鏁扮粍鐨勬寚閽?/span>
    T *m_array;       //淇濆瓨鏁扮粍鐨勮搗濮嬪湴鍧
    int m_size;       //淇濆瓨鏁扮粍鐨勫ぇ灝?/span>
};

template
<typename T>
inline Ptr2T
<T>& Ptr2T<T>::operator++()
{
    m_p 
+= 1;
    
return *this;
}

template
<typename T>
inline 
const Ptr2T<T> Ptr2T<T>::operator++(int)
{
    Ptr2T current 
= *this;
    
++(*this);       //鐢ㄩ噸杞界殑鍓嶇紑++鏉ュ疄鐜?/span>
    
    
return current;
}

template
<typename T>
inline Ptr2T
<T>& Ptr2T<T>::operator--()
{
    m_p 
-= 1;
    
return *this;
}

template
<typename T>
inline 
const Ptr2T<T> Ptr2T<T>::operator--(int)
{
    Ptr2T current 
= *this;
    
--(*this);       //鐢ㄩ噸杞界殑鍓嶇紑--鏉ュ疄鐜?/span>

    
return current;
}

template
<typename T>
inline T
& Ptr2T<T>::operator*() const
{
    
if (m_p < m_array || m_p > m_array + m_size - 1) {  //瓚婄晫媯鏌?/span>
        throw out_of_range("out of range");
    }

    
return *m_p;
}

template
<typename T>
inline Ptr2T
<T>& Ptr2T<T>::operator+=(int n)
{
    m_p 
+= n;
    
return *this;
}

template
<typename T>
inline Ptr2T
<T>& Ptr2T<T>::operator-=(int n)
{
    m_p 
-= n;
    
return *this;
}

template
<typename T>
Ptr2T
<T> operator+(const Ptr2T<T> &p, const int n)
{
    
return Ptr2T<T>(p) += n;   //鐢ㄩ噸杞界殑+=鏉ュ疄鐜?/span>
}

template
<typename T>
Ptr2T
<T> operator+(const int n, const Ptr2T<T> &p)
{
    
return p + n;
}

template
<typename T>
Ptr2T
<T> operator-(const Ptr2T<T> &p, const int n)
{
    
return Ptr2T<T>(p) -= n;  //鐢ㄩ噸杞界殑-=鏉ュ疄鐜?/span>
}

//浣跨敤鏂規硶
int main(void)
{
    
char a[5= {'a''b''c''d''e'};
    
int b[5= {12345}; 

    Ptr2T
<char> pc(a, 5);
    Ptr2T
<int> pi(b, 5);

    cout 
<< *pc++ << endl;
    pi
--;
    pi 
+= 2;
    cout 
<< *(pi - 1<< endl;

    
*++pi = 100;
    cout 
<< *pi << endl;
    
    
return 0;
}



Marcky 2009-08-13 18:29 鍙戣〃璇勮
]]>
鏄劇ず鏋勯犲嚱鏁頒笌杞崲榪愮畻絎︾殑鍚堜綔http://www.shnenglu.com/Marcky/archive/2009/08/13/93193.htmlMarckyMarckyThu, 13 Aug 2009 06:39:00 GMThttp://www.shnenglu.com/Marcky/archive/2009/08/13/93193.htmlhttp://www.shnenglu.com/Marcky/comments/93193.htmlhttp://www.shnenglu.com/Marcky/archive/2009/08/13/93193.html#Feedback0http://www.shnenglu.com/Marcky/comments/commentRss/93193.htmlhttp://www.shnenglu.com/Marcky/services/trackbacks/93193.html
class Year {
    
int m_y;
public:
//explicit闄愬埗int鍒癥ear鐨勯殣寮忚漿鎹?/span>
    explicit Year(int y)
        : y(m_y) { }
//Year鍒癷nt鐨勭被鍨嬭漿鎹?nbsp;  
    operator int() const 
        { 
return m_y; }
    
//other funtion
}


class Date {
public :
    Date(
int d, Month m, Year y);
    
//
};

Date d1(
1987, feb, 21);   //error, 21涓嶈兘闅愬紡杞崲涓篩ear
Date d2(21, feb, Year(1987)); //ok



鍦ㄨ繖閲孻ear灝卞彧鏄寘瑁逛綇浜唅nt錛屽int鎻愪緵涓灞備繚鎶よ屽凡銆傜敱浜巓perator int()鐨勫瓨鍦紝鍙闇瑕侊紝Year鍙互闅愬紡鐨勮漿鍖栦負int鍑虹幇榪愮畻琛ㄨ揪寮忎腑鍙傚姞榪愮畻銆傝岄氳繃緇欐瀯閫犲嚱鏁板0鏄庝負explicit錛屽氨鑳藉淇濊瘉錛宨nt鍒癥ear鐨勮漿鍖栧彧鑳藉湪鏄庣‘鏃犺鐨勬儏鍐佃繘琛岋紝閬垮厤浜嗘剰澶栫殑璧嬪箋?br>
鏄劇ず鏋勯犲嚱鏁板拰杞崲榪愮畻絎︾殑鍚堜綔錛岃Year鍙互褰搃nt浣跨敤錛屽悓鏃跺張瀵筜ear榪涜涓瀹氱殑淇濇姢銆傘傘?br>



Marcky 2009-08-13 14:39 鍙戣〃璇勮
]]>
Allocating Arrays Using Placement new (zz)http://www.shnenglu.com/Marcky/archive/2009/08/13/93110.htmlMarckyMarckyWed, 12 Aug 2009 16:48:00 GMThttp://www.shnenglu.com/Marcky/archive/2009/08/13/93110.htmlhttp://www.shnenglu.com/Marcky/comments/93110.htmlhttp://www.shnenglu.com/Marcky/archive/2009/08/13/93110.html#Feedback0http://www.shnenglu.com/Marcky/comments/commentRss/93110.htmlhttp://www.shnenglu.com/Marcky/services/trackbacks/93110.htmlnew enables you to construct an object or an array of objects at a predetermined memory position. This version is called placement new and has many useful applications, including building a custom-made memory pool or a garbage collector. Additionally, it can be used in mission-critical applications because there's no danger of allocation failure; the memory that's used by placement new has already been allocated. Placement new is also faster because the construction of an object on a preallocated buffer takes less time.

You already know how to use placement new to allocate a single object on a predetermined memory address. However, some programming tasks require the allocation of arrays on a predetermined memory address. Here's how you do it.

Placement new Overview

Mobile devices, embedded systems and custom garbage collectors are only a few instances of programming environments that may require placement new allocation of arrays. Before I discuss the details of such array allocations, let's remind ourselves briefly how scalar (i.e. non-array) placement new works.

The scalar version of placement new takes a user-supplied address on which it constructs a single object. Unlike the ordinary version of the new operator, placement new doesn't allocate storage for the object; it merely constructs the object on the memory address you provide:

#include <new> //required for using placement new
class Widget {
public:
    Widget();
    
virtual ~Widget
    
virtual void Draw();
};
char* buf=new char [sizeof (Widget)];//preallocate
Widget* widget= new(buf) Widget; //construct Widget on buf
widget->Draw(); //use Widget

To destroy widget you first have to invoke its destructor explicitly:

widget->~Widget(); //explicit destructor invocation

Next, reclaim the raw memory like this:

delete[] buf;

Array Allocation

Allocating arrays with placement new follows the same steps more or less, but you have to pay attention to additional nuances. Here is a step-by-step guide:

First, allocate a buffer large enough to hold an array of the desired type:

const int ARRSIZE = 15;
char * buf= new [sizeof(Widget)*ARRSIZE];

Don't be tempted to calculate the size manually; always use sizeof to ensure that the buffer is properly aligned and has the right size.

Next, construct an array of ARRSIZE objects on the buffer using placement new[] :

Widget* widgets=new(buf) Widget[ARRSIZE];//construct an array

You can now use the allocated array as usual:

for (int i=0; i<ARRSIZE; i++)
{
 widgets[i].Draw();
}
Make sure that your target class -- Widget in this example -- has a public default constructor. Otherwise, it would be impossible to create arrays thereof.

Destroying the Array

To destroy such an array allocated by placement new you have to call the destructor for each element explicitly:

int i=ARRSIZE;
while (i)
    widgets[
--i].~Widget();

The while -loop uses a descending order to preserve the canonical destruction order of C++ -- the object that was constructed last must be destroyed first. To comply with this requirement, the element with the highest index is destroyed first.

Finally, you release the raw memory on which the array resided by calling delete[] :

delete[] buf;

Performance Tuning

The array placement new has a potential performance problem: it initializes every element in the array unconditionally. If your app deals with large arrays, this isn't the most efficient way. In some apps only a portion of the array is actually used, and in other apps the elements are assigned a different value immediately after their construction. In these cases, you want to postpone, or even completely avoid, the automatic initialization of array elements. To avoid the initialization of placement new arrays, follow the following steps:

As before, begin with an allocation of a raw buffer with the appropriate size. This time however, use the global operator new instead of the new operator:

Widget * warr=
static_cast
<Widget*> (::operator new ( sizeof(Widget)* ARRSIZE));

The global operator new , very much like C's malloc() , merely allocates raw bytes of memory from the free-store, without initializing them. It returns void * rather than Widget* which is why you need to cast the result explicitly.

At this stage, warr is a pointer to raw memory. You can't access its elements because they haven't been initialized yet. To initialize individual elements, call placement new once more, for each element you want initialized:

void assign(Widget arr[], size_t & sz,  const Widget& init)
{
    
new (&arr[sz++]) Widget (init); //invoke copy ctor
}

assign() passes the address of an individual element to placement new which in turn invokes Widget 's copy constructor. The copy-constructor initializes that element with init . Using this technique, you can initialize elements selectively, leaving the rest of the array uninitialized.

To destroy such an array, invoke the destructor of every initialized object. Then call the global operator delete to reclaim the raw storage:

void destroy(Widget arr[], size_t & sz)
{
    
while (sz)
    {
        arr[
--sz].~Widget();//destroy all initialized elements
    }
     ::
operator delete (arr); //reclaim raw storage
}

Summary

The techniques I've presented here are bug prone. Therefore, they should be encapsulated in higher-level classes that hide the implementation details from users. These techniques aren't rarely-used as they might seem. STL allocators use them under the hood to avoid object initialization and minimize reallocations.





Marcky 2009-08-13 00:48 鍙戣〃璇勮
]]>
澶嶅埗鏋勯犲嚱鏁頒箣嫻呭鍒朵笌娣卞鍒?/title><link>http://www.shnenglu.com/Marcky/archive/2009/07/13/89910.html</link><dc:creator>Marcky</dc:creator><author>Marcky</author><pubDate>Sun, 12 Jul 2009 17:56:00 GMT</pubDate><guid>http://www.shnenglu.com/Marcky/archive/2009/07/13/89910.html</guid><wfw:comment>http://www.shnenglu.com/Marcky/comments/89910.html</wfw:comment><comments>http://www.shnenglu.com/Marcky/archive/2009/07/13/89910.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/Marcky/comments/commentRss/89910.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/Marcky/services/trackbacks/89910.html</trackback:ping><description><![CDATA[     鎽樿: 澶嶅埗鏋勯犲嚱鏁扮殑鍑芥暟鍚嶄負綾葷殑鍚嶅瓧錛屾棤榪斿洖鍊鹼紝鍜屾瀯閫犲嚱鏁扮殑鍖哄埆灝卞湪浜庡艦鍙傜殑涓嶅悓銆傚鍒舵瀯閫犲嚱鏁扮殑褰㈠弬涓哄悓綾葷被鍨嬬殑寮曠敤錛屽茍涓旈氬父闄愬畾涓篶onst鐨勫紩鐢紝濡侾erson綾葷殑澶嶅埗鏋勯犲嚱鏁扮殑澹版槑涓猴細  <a href='http://www.shnenglu.com/Marcky/archive/2009/07/13/89910.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/Marcky/aggbug/89910.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/Marcky/" target="_blank">Marcky</a> 2009-07-13 01:56 <a href="http://www.shnenglu.com/Marcky/archive/2009/07/13/89910.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鏋勯犲嚱鏁板垵濮嬪寲鍒楄〃http://www.shnenglu.com/Marcky/archive/2009/07/11/89807.htmlMarckyMarckySat, 11 Jul 2009 09:47:00 GMThttp://www.shnenglu.com/Marcky/archive/2009/07/11/89807.htmlhttp://www.shnenglu.com/Marcky/comments/89807.htmlhttp://www.shnenglu.com/Marcky/archive/2009/07/11/89807.html#Feedback0http://www.shnenglu.com/Marcky/comments/commentRss/89807.htmlhttp://www.shnenglu.com/Marcky/services/trackbacks/89807.htmlclass Person {
public:
Person() { } //default constructor function
Person(string name, string phone, string addr)  闃呰鍏ㄦ枃

Marcky 2009-07-11 17:47 鍙戣〃璇勮
]]>
const褰㈠弬鐨勫嚱鏁伴噸杞?/title><link>http://www.shnenglu.com/Marcky/archive/2009/07/11/89796.html</link><dc:creator>Marcky</dc:creator><author>Marcky</author><pubDate>Sat, 11 Jul 2009 07:09:00 GMT</pubDate><guid>http://www.shnenglu.com/Marcky/archive/2009/07/11/89796.html</guid><wfw:comment>http://www.shnenglu.com/Marcky/comments/89796.html</wfw:comment><comments>http://www.shnenglu.com/Marcky/archive/2009/07/11/89796.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/Marcky/comments/commentRss/89796.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/Marcky/services/trackbacks/89796.html</trackback:ping><description><![CDATA[     鎽樿: 銆奀++ primer銆嬩腑鎻愬埌鈥滀粎褰撳艦鍙傛槸寮曠敤鎴栨寚閽堢殑鏃跺欙紝褰㈠弬鏄惁涓篶onst鎵嶅閲嶈澆鏈夊獎鍝嶃傗?nbsp; <a href='http://www.shnenglu.com/Marcky/archive/2009/07/11/89796.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/Marcky/aggbug/89796.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/Marcky/" target="_blank">Marcky</a> 2009-07-11 15:09 <a href="http://www.shnenglu.com/Marcky/archive/2009/07/11/89796.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍏充簬澶氭佺殑鏈夎叮鐞嗚Вhttp://www.shnenglu.com/Marcky/archive/2009/07/05/89316.htmlMarckyMarckySun, 05 Jul 2009 14:12:00 GMThttp://www.shnenglu.com/Marcky/archive/2009/07/05/89316.htmlhttp://www.shnenglu.com/Marcky/comments/89316.htmlhttp://www.shnenglu.com/Marcky/archive/2009/07/05/89316.html#Feedback0http://www.shnenglu.com/Marcky/comments/commentRss/89316.htmlhttp://www.shnenglu.com/Marcky/services/trackbacks/89316.html闃呰鍏ㄦ枃

Marcky 2009-07-05 22:12 鍙戣〃璇勮
]]>
NULL, 0, \0 ,nul鐨勫尯鍒?杞澆)http://www.shnenglu.com/Marcky/archive/2009/07/01/89032.htmlMarckyMarckyWed, 01 Jul 2009 15:10:00 GMThttp://www.shnenglu.com/Marcky/archive/2009/07/01/89032.htmlhttp://www.shnenglu.com/Marcky/comments/89032.htmlhttp://www.shnenglu.com/Marcky/archive/2009/07/01/89032.html#Feedback0http://www.shnenglu.com/Marcky/comments/commentRss/89032.htmlhttp://www.shnenglu.com/Marcky/services/trackbacks/89032.htmlNULL is a macro defined in several standard headers, 0 is an integer constant, '\0' is a character constant, and nul is the name of the character constant. All of these are not interchangeable:

NULL is to be used for pointers only since it may be defined as ((void *)0), this would cause problems with anything but pointers.

0 can be used anywhere, it is the generic symbol for each type's zero value and the compiler will sort things out.

'\0' should be used only in a character context.

nul is not defined in C or C++, it shouldn't be used unless you define it yourself in a suitable manner, like:

#define nul '\0'

 





Marcky 2009-07-01 23:10 鍙戣〃璇勮
]]>
瓚呭ぇ鏁存暟鐨勫姞娉曡繍綆?/title><link>http://www.shnenglu.com/Marcky/archive/2009/06/30/88904.html</link><dc:creator>Marcky</dc:creator><author>Marcky</author><pubDate>Tue, 30 Jun 2009 08:02:00 GMT</pubDate><guid>http://www.shnenglu.com/Marcky/archive/2009/06/30/88904.html</guid><wfw:comment>http://www.shnenglu.com/Marcky/comments/88904.html</wfw:comment><comments>http://www.shnenglu.com/Marcky/archive/2009/06/30/88904.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/Marcky/comments/commentRss/88904.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/Marcky/services/trackbacks/88904.html</trackback:ping><description><![CDATA[       鎵璋撹秴澶ф暟灝辨槸int, 鐢氳嚦long int絳夋暟鎹被鍨嬫棤娉曠洿鎺ュ鍏跺瓨鍌ㄧ殑鏁存暟銆傚浜庤繖縐嶈秴澶ф暟鐨勫姞娉曡繍綆楋紝鎴戠殑瑙e喅鏂規鏄細<br>       棣栧厛灝嗚緭鍏ョ殑澶ф暟杞寲涓哄瓧絎︿覆瀛樺偍璧鋒潵錛岃繖鏍蜂竴鏉ワ紝瀛楃涓茬殑棣栧瓧絎﹀氨瀵瑰簲鐫澶ф暟鐨勬渶楂樹綅錛屾湯瀛楃灝卞搴斿ぇ鏁扮殑鏈浣庝綅銆?br>       鐒跺悗錛屼粠涓や釜瀛楃涓茬殑鏈熬寮濮嬪彇鍑轟竴涓瓧絎︼紝灝嗗叾杞寲涓轟竴涓竴浣嶆暣鏁板悗榪涜鐩稿姞錛堣繖閲岀浉鍔犵殑鏃跺欒繕闇瑕佸姞涓婅繘浣嶆爣蹇楃殑鍊鹼級錛岃繖鏍峰皢浜х敓涓ょ鎯呭喌錛?br>              涓銆佺浉鍔犲悗澶т簬絳変簬10錛岄渶瑕佽繘1浣嶃?br>              浜屻佺浉鍔犲悗灝忎簬10錛屼笉闇瑕佽繘浣嶃?br>       寰呭涓や釜瀛楃涓蹭腑鐨勬墍鏈変綅瀛楃閮藉鐞嗗畬鎴愬悗錛屽氨寰楀埌浜嗕竴涓浉鍔犵殑緇撴灉瀛楃涓詫紝榪欎釜緇撴灉瀛楃涓茬殑涓嶈凍涔嬪鏄寜浣庝綅鍒伴珮浣嶇殑欏哄簭鎺掑垪鐨勩傛墍浠ヨ繕寰楀鍏墮珮浣庝綅鐨勫搴斿瓧絎﹁繘琛屼氦鎹㈠鐞嗭紝浠庤屽緱鍑烘紜殑緇撴灉鍜屽瓧絎︿覆銆傘傘?br><br>澶ф暟鐩稿姞鐨勫嚱鏁癈浠g爜濡備笅錛?br> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008000;">/*</span><span style="color: #008000;"><br> *鍔熻兘錛歛ddBigNum鍑芥暟鐨勫姛鑳戒負瀵逛袱涓ぇ鏁拌繘琛岀浉鍔犺繍綆椼?br> *鍙傛暟錛歱a, pb鎸囧悜闇瑕佺浉鍔犵殑涓や釜澶ф暟鐨勫瓧絎︿覆琛ㄧず銆?br> *          psum鎸囧悜鐨勭紦鍐插尯鐢ㄦ潵瀛樺偍鐩稿姞鐨勭粨鏋滃拰鐨勫瓧絎︿覆琛ㄧず銆?br> *榪斿洖鍊鹼細鏃?br> </span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">void</span><span style="color: #000000;"> addBigNum(</span><span style="color: #0000ff;">char</span><span style="color: #000000;"> </span><span style="color: #000000;">*</span><span style="color: #000000;">pa, </span><span style="color: #0000ff;">char</span><span style="color: #000000;"> </span><span style="color: #000000;">*</span><span style="color: #000000;">pb, </span><span style="color: #0000ff;">char</span><span style="color: #000000;"> </span><span style="color: #000000;">*</span><span style="color: #000000;">psum)<br>{<br>    </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> indexa, indexb, index;<br>    </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> sum, addone;<br><br>    addone </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">; </span><span style="color: #008000;">//</span><span style="color: #008000;">鍚戦珮浣嶈繘涓鏍囧織</span><span style="color: #008000;"><br></span><span style="color: #000000;">    index </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">;  </span><span style="color: #008000;">//</span><span style="color: #008000;">psum鐨勪綅緗儲寮?br><br>    </span><span style="color: #008000;">//</span><span style="color: #008000;">indexa, indexb鍒嗗埆绱㈠紩鍒板瓧絎︿覆stra, strb鐨勬渶鍚庝竴涓瓧絎?/span><span style="color: #008000;"><br></span><span style="color: #000000;">    indexa </span><span style="color: #000000;">=</span><span style="color: #000000;"> strlen(pa) </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #000000;">1</span><span style="color: #000000;">;<br>    indexb </span><span style="color: #000000;">=</span><span style="color: #000000;"> strlen(pb) </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #000000;">1</span><span style="color: #000000;">;<br>    <br>    </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> ( ; indexa </span><span style="color: #000000;">>=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;"> </span><span style="color: #000000;">||</span><span style="color: #000000;"> indexb </span><span style="color: #000000;">>=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">; indexa</span><span style="color: #000000;">--</span><span style="color: #000000;">, indexb</span><span style="color: #000000;">--</span><span style="color: #000000;">) {<br>        </span><span style="color: #008000;">//</span><span style="color: #008000;">澶勭悊瀛楃涓查暱搴︿笉鍚岀殑榪愮畻</span><span style="color: #008000;"><br></span><span style="color: #000000;">        </span><span style="color: #0000ff;">if</span><span style="color: #000000;"> (indexa </span><span style="color: #000000;">>=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;"> </span><span style="color: #000000;">&&</span><span style="color: #000000;"> indexb </span><span style="color: #000000;">>=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">) { <br>            sum </span><span style="color: #000000;">=</span><span style="color: #000000;"> (pa[indexa] </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #000000;">'</span><span style="color: #000000;">0</span><span style="color: #000000;">'</span><span style="color: #000000;">) </span><span style="color: #000000;">+</span><span style="color: #000000;"> (pb[indexb] </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #000000;">'</span><span style="color: #000000;">0</span><span style="color: #000000;">'</span><span style="color: #000000;">) </span><span style="color: #000000;">+</span><span style="color: #000000;"> addone;<br>        } </span><span style="color: #0000ff;">else</span><span style="color: #000000;"> </span><span style="color: #0000ff;">if</span><span style="color: #000000;"> (indexa </span><span style="color: #000000;">>=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;"> </span><span style="color: #000000;">&&</span><span style="color: #000000;"> indexb </span><span style="color: #000000;"><</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">) {<br>            sum </span><span style="color: #000000;">=</span><span style="color: #000000;"> (pa[indexa] </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #000000;">'</span><span style="color: #000000;">0</span><span style="color: #000000;">'</span><span style="color: #000000;">) </span><span style="color: #000000;">+</span><span style="color: #000000;"> addone;<br>        } </span><span style="color: #0000ff;">else</span><span style="color: #000000;"> </span><span style="color: #0000ff;">if</span><span style="color: #000000;"> (indexa </span><span style="color: #000000;"><</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;"> </span><span style="color: #000000;">&&</span><span style="color: #000000;"> indexb </span><span style="color: #000000;">>=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">) {<br>            sum </span><span style="color: #000000;">=</span><span style="color: #000000;"> (pb[indexb] </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #000000;">'</span><span style="color: #000000;">0</span><span style="color: #000000;">'</span><span style="color: #000000;">) </span><span style="color: #000000;">+</span><span style="color: #000000;"> addone;<br>        }<br>        <br>        </span><span style="color: #0000ff;">if</span><span style="color: #000000;"> (sum </span><span style="color: #000000;">>=</span><span style="color: #000000;"> </span><span style="color: #000000;">10</span><span style="color: #000000;">) {<br>            </span><span style="color: #008000;">//</span><span style="color: #008000;">涓や釜涓浣嶆暟緇勭浉鍔犳渶澶氬悜楂樹綅榪?</span><span style="color: #008000;"><br></span><span style="color: #000000;">            psum[index</span><span style="color: #000000;">++</span><span style="color: #000000;">] </span><span style="color: #000000;">=</span><span style="color: #000000;"> sum </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #000000;">10</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #000000;">'</span><span style="color: #000000;">0</span><span style="color: #000000;">'</span><span style="color: #000000;">;<br>            addone </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">1</span><span style="color: #000000;">;<br>        } </span><span style="color: #0000ff;">else</span><span style="color: #000000;"> {<br>            psum[index</span><span style="color: #000000;">++</span><span style="color: #000000;">] </span><span style="color: #000000;">=</span><span style="color: #000000;"> sum </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #000000;">'</span><span style="color: #000000;">0</span><span style="color: #000000;">'</span><span style="color: #000000;">;<br>            addone </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">;<br>        }<br>    }<br><br>    psum[index] </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">'</span><span style="color: #000000;">\0</span><span style="color: #000000;">'</span><span style="color: #000000;">;<br>    swapStr(psum);<br>    <br>    </span><span style="color: #0000ff;">return</span><span style="color: #000000;">;<br>}<br><br></span><span style="color: #0000ff;">void</span><span style="color: #000000;"> swapStr(</span><span style="color: #0000ff;">char</span><span style="color: #000000;"> </span><span style="color: #000000;">*</span><span style="color: #000000;">str)<br>{<br>    </span><span style="color: #008000;">//</span><span style="color: #008000;">瀵箂tr鎸囧悜鐨勫瓧絎︿覆涓殑瀛楃榪涜閫嗗悜閲嶆帓.</span><span style="color: #008000;"><br></span><span style="color: #000000;">    </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> len, i;<br>    </span><span style="color: #0000ff;">char</span><span style="color: #000000;"> temp;<br><br>    len </span><span style="color: #000000;">=</span><span style="color: #000000;"> strlen(str);<br>    <br>    </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> (i </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">; i </span><span style="color: #000000;"><</span><span style="color: #000000;"> len </span><span style="color: #000000;">/</span><span style="color: #000000;"> </span><span style="color: #000000;">2</span><span style="color: #000000;">; i</span><span style="color: #000000;">++</span><span style="color: #000000;">) {<br>        temp </span><span style="color: #000000;">=</span><span style="color: #000000;"> str[i];<br>        str[i] </span><span style="color: #000000;">=</span><span style="color: #000000;"> str[len </span><span style="color: #000000;">-</span><span style="color: #000000;"> i </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #000000;">1</span><span style="color: #000000;">];<br>        str[len </span><span style="color: #000000;">-</span><span style="color: #000000;"> i </span><span style="color: #000000;">-</span><span style="color: #000000;"> </span><span style="color: #000000;">1</span><span style="color: #000000;">] </span><span style="color: #000000;">=</span><span style="color: #000000;"> temp;<br>    }<br>}<br></span></div> <br><br> <img src ="http://www.shnenglu.com/Marcky/aggbug/88904.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/Marcky/" target="_blank">Marcky</a> 2009-06-30 16:02 <a href="http://www.shnenglu.com/Marcky/archive/2009/06/30/88904.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.18xh.cn" target="_blank">国产成人精品久久综合</a>| <a href="http://www.caregps.cn" target="_blank">欧美精品一区二区久久</a>| <a href="http://www.zhijin168.com.cn" target="_blank">青草国产精品久久久久久</a>| <a href="http://www.mijie5.cn" target="_blank">久久精品黄AA片一区二区三区</a>| <a href="http://www.126yi.cn" target="_blank">99久久99久久久精品齐齐</a>| <a href="http://www.newcr.cn" target="_blank">久久丝袜精品中文字幕</a>| <a href="http://www.aystone.cn" target="_blank">久久亚洲美女精品国产精品</a>| <a href="http://www.csmfy.cn" target="_blank">93精91精品国产综合久久香蕉 </a>| <a href="http://www.aion999.cn" target="_blank">亚洲精品乱码久久久久久自慰</a>| <a href="http://www.ttyv.cn" target="_blank">久久精品亚洲日本波多野结衣 </a>| <a href="http://www.trgba.cn" target="_blank">久久久国产精华液</a>| <a href="http://www.tzzdj.cn" target="_blank">亚洲乱码中文字幕久久孕妇黑人 </a>| <a href="http://www.lyscpf.cn" target="_blank">一本大道久久香蕉成人网</a>| <a href="http://www.21tjsports.cn" target="_blank">综合人妻久久一区二区精品</a>| <a href="http://www.ha-jc.cn" target="_blank">激情五月综合综合久久69</a>| <a href="http://www.135gkr4.cn" target="_blank">久久精品aⅴ无码中文字字幕不卡 久久精品aⅴ无码中文字字幕重口 </a>| <a href="http://www.madgou.cn" target="_blank">久久精品亚洲AV久久久无码</a>| <a href="http://www.hzf89.cn" target="_blank">免费国产99久久久香蕉</a>| <a href="http://www.hbrsksy.cn" target="_blank">亚洲色欲久久久综合网东京热</a>| <a href="http://www.manour.cn" target="_blank">久久e热在这里只有国产中文精品99</a>| <a href="http://www.ohdou.cn" target="_blank">日本欧美久久久久免费播放网</a>| <a href="http://www.jisuvpn.cn" target="_blank">久久综合色之久久综合</a>| <a href="http://www.shenpenghw.cn" target="_blank">青青青伊人色综合久久</a>| <a href="http://www.6ht.com.cn" target="_blank">999久久久免费精品国产</a>| <a href="http://www.mortels.cn" target="_blank">久久天天躁狠狠躁夜夜avapp</a>| <a href="http://www.yunqichaoyang.cn" target="_blank">久久久久国产精品麻豆AR影院</a>| <a href="http://www.jcfw-1.cn" target="_blank">久久久国产精品网站</a>| <a href="http://www.dxcheck.cn" target="_blank">国内精品伊人久久久久AV影院</a>| <a href="http://www.todd3015.cn" target="_blank">欧美伊人久久大香线蕉综合</a>| <a href="http://www.37photo.com.cn" target="_blank">久久夜色精品国产亚洲av</a>| <a href="http://www.idotime.cn" target="_blank">99热成人精品免费久久</a>| <a href="http://www.dlwz8.cn" target="_blank">91精品国产91久久久久久</a>| <a href="http://www.athj.cn" target="_blank">狠狠色丁香婷综合久久</a>| <a href="http://www.17wgame.cn" target="_blank">久久精品国产亚洲av日韩</a>| <a href="http://www.xfqbaby.cn" target="_blank">人妻久久久一区二区三区</a>| <a href="http://www.tuht.cn" target="_blank">亚洲精品乱码久久久久久久久久久久</a>| <a href="http://www.wuxicld.cn" target="_blank">伊人久久五月天</a>| <a href="http://www.ccssoo.com.cn" target="_blank">国产精品久久久久久久久久影院</a>| <a href="http://www.hycv.cn" target="_blank">四虎影视久久久免费</a>| <a href="http://www.qvella.cn" target="_blank">久久精品免费一区二区</a>| <a href="http://www.shawcai.cn" target="_blank">亚洲色婷婷综合久久</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>