腾讯2017实习生招聘软件开发编程题

// 17年4月3日  腾讯2017实习生软件开发编程题1
#include <iostream> #include <string> #include <iomanip> using namespace std; int main() { int m = 0, num = 0, index = 0, indCur = 0; string arr,valCur; cin >> arr; num = arr.length(); m = num/16; for(int i = 0; i < m; i++) { cout << setfill('0')<< setw(8) << hex << index << " "; index +=16; for(int j = 0; j < 16; j++,indCur++) { cout << hex << int(arr[indCur]) <<" "; } cout << " "; indCur -= 16; for(int k = 0 ; k < 16 ; k++,indCur++) { cout << arr[indCur]; } cout << endl; } return 0; }

 

posted @ 2017-04-04 21:57  爱简单的Paul  阅读(339)  评论(0编辑  收藏  举报