- 最後登錄
- 2024-5-22
- 在線時間
- 29001 小時
- 註冊時間
- 2011-12-11
- 閱讀權限
- 95
- 精華
- 3
- UID
- 10643381
- 帖子
- 3224
- 積分
- 24366 點
- 潛水值
- 77410 米
| - #include <cstdio>
- #include <cstdlib>
- using namespace std;
- void Conv(const char* str1 , const char* str2)
- {
- int result = 0;
- int i = 0;
-
- do
- {
- result <<= 1;
- result |= (str1[i++] == 'X');
- }while(i < 8);
-
- print f("0x%02x , " , result);
-
- result = 0 , i = 0;
- do
- {
- result <<= 1;
- result |= (str2[i++] == 'X');
- }while(i < 8);
- print f("0x%02x\n" , result);
- }
- int main()
- {
- Conv("_____XX_" , "________");
- Conv("_____X__" , "____X___");
- Conv("_XXXXXXX" , "XXXXXX__");
- system("pause");
- return 0;
- }
複製代碼 ... |
|