資源簡(jiǎn)介
快來(lái)下載啊,只需要1積分!!!這個(gè)是劍指offer的源碼,挺全的,還有具體的測(cè)試用例~

代碼片段和文件信息
//?NumberOf1InBinary.cpp?:?Defines?the?entry?point?for?the?console?application.
//
//?《劍指Offer——名企面試官精講典型編程題》代碼
//?著作權(quán)所有者:何海濤
#include?“stdafx.h“
int?NumberOf1_Solution1(int?n)
{
????int?count?=?0;
????unsigned?int?flag?=?1;
????while(flag)
????{
????????if(n?&?flag)
????????????count?++;
????????flag?=?flag?<1;
????}
????return?count;
}
int?NumberOf1_Solution2(int?n)
{
????int?count?=?0;
????while?(n)
????{
????????++?count;
????????n?=?(n?-?1)?&?n;
????}
????return?count;
}
void?Test(int?number?unsigned?int?expected)
{
????int?actual?=?NumberOf1_Solution1(number);
????if(actual?==?expected)
????????printf(“Solution1:?Test?for?%p?passed.\n“?number);
????else
????????printf(“Solution1:?Test?for?%p?failed.\n“?number);
????actual?=?NumberOf1_Solution2(number);
????if(actual?==?expected)
????????printf(“Solution2:?Test?for?%p?passed.\n“?number);
????else
????????printf(“Solution2:?Test?for?%p?failed.\n“?number);
????printf(“\n“);
}
int?_tmain(int?argc?_TCHAR*?argv[])
{
????//?輸入0,期待的輸出是0
????Test(0?0);
????//?輸入1,期待的輸出是1
????Test(1?1);
????//?輸入10,期待的輸出是2
????Test(10?2);
????//?輸入0x7FFFFFFF,期待的輸出是31
????Test(0x7FFFFFFF?31);
????//?輸入0xFFFFFFFF(負(fù)數(shù)),期待的輸出是32
????Test(0xFFFFFFFF?32);
????//?輸入0x80000000(負(fù)數(shù)),期待的輸出是1
????Test(0x80000000?1);
????return?0;
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????1470??2011-09-30?15:25??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\10NumberOf1InBinary\NumberOf1InBinary.cpp
?????文件???????4549??2011-06-20?17:29??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\10NumberOf1InBinary\NumberOf1InBinary.vcproj
?????文件???????1417??2011-10-24?11:50??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\10NumberOf1InBinary\NumberOf1InBinary.vcproj.HAIHE-WIN7.Harry?He.user
?????文件???????1427??2015-09-08?18:48??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\10NumberOf1InBinary\NumberOf1InBinary.vcproj.USER-20150421XR.Administrator.user
?????文件???????1362??2011-02-05?08:23??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\10NumberOf1InBinary\ReadMe.txt
?????文件????????304??2011-02-05?08:23??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\10NumberOf1InBinary\stdafx.cpp
?????文件????????320??2011-02-05?08:23??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\10NumberOf1InBinary\stdafx.h
?????文件????????765??2011-02-05?08:23??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\10NumberOf1InBinary\targetver.h
?????文件???????2553??2011-10-24?11:48??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\11Power\Power.cpp
?????文件???????4513??2011-06-08?17:26??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\11Power\Power.vcproj
?????文件???????1417??2011-10-24?11:50??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\11Power\Power.vcproj.HAIHE-WIN7.Harry?He.user
?????文件???????1427??2015-09-08?18:48??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\11Power\Power.vcproj.USER-20150421XR.Administrator.user
?????文件???????1290??2011-03-16?09:58??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\11Power\ReadMe.txt
?????文件????????292??2011-03-16?09:58??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\11Power\stdafx.cpp
?????文件????????320??2011-03-16?09:58??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\11Power\stdafx.h
?????文件????????765??2011-03-16?09:58??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\11Power\targetver.h
?????文件???????2968??2011-09-30?15:25??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\12Print1ToMaxOfNDigits\Print1ToMaxOfNDigits.cpp
?????文件???????4558??2011-06-08?17:26??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\12Print1ToMaxOfNDigits\Print1ToMaxOfNDigits.vcproj
?????文件???????1417??2011-10-24?11:50??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\12Print1ToMaxOfNDigits\Print1ToMaxOfNDigits.vcproj.HAIHE-WIN7.Harry?He.user
?????文件???????1427??2015-09-08?18:48??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\12Print1ToMaxOfNDigits\Print1ToMaxOfNDigits.vcproj.USER-20150421XR.Administrator.user
?????文件???????1380??2011-03-19?22:42??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\12Print1ToMaxOfNDigits\ReadMe.txt
?????文件????????307??2011-03-19?22:42??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\12Print1ToMaxOfNDigits\stdafx.cpp
?????文件????????320??2011-03-19?22:42??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\12Print1ToMaxOfNDigits\stdafx.h
?????文件????????765??2011-03-19?22:42??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\12Print1ToMaxOfNDigits\targetver.h
?????文件???????3277??2011-09-30?15:25??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\13DeleteNodeInList\DeleteNodeInList.cpp
?????文件???????4546??2011-06-20?17:29??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\13DeleteNodeInList\DeleteNodeInList.vcproj
?????文件???????1417??2011-10-24?11:50??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\13DeleteNodeInList\DeleteNodeInList.vcproj.HAIHE-WIN7.Harry?He.user
?????文件???????1427??2015-09-08?18:48??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\13DeleteNodeInList\DeleteNodeInList.vcproj.USER-20150421XR.Administrator.user
?????文件???????1356??2011-03-27?23:09??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\13DeleteNodeInList\ReadMe.txt
?????文件????????303??2011-03-27?23:09??劍指offer源碼及測(cè)試用例\劍指offer源碼及測(cè)試用例\InterviewQuestions\13DeleteNodeInList\stdafx.cpp
............此處省略518個(gè)文件信息
評(píng)論
共有 條評(píng)論