2006年10月北京中软笔试题
出自求职百科
点击排行
- Index - (262701)
- 宝洁 - (59889)
- 华为 - (56775)
- 普华永道 - (44261)
- IBM - (41710)
- 中国银行 - (37965)
- 毕马威 - (35272)
- 招商银行 - (32220)
- 富士康 - (32020)
- 强生 - (31904)
最近更新
北京中软笔试题
1.不许用中间变量,把String ABCDE 倒转
2.10000个数求第2大的数,不许用排序算法.
3.排序算法的测试用例
我的答案:
1.
- include "stdafx.h"
- include <iostream>
- include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
char *ps = new char[15];
strcpy_s(ps,15,"I am yuchifang");
cout<<"before reverse:"<<endl;
cout<<ps<<endl;
int i = 0;
int j = 13;
while(i<j)
{
ps[i] = ps[i]+ps[j];
ps[j] = ps[i]-ps[j];
ps[i] = ps[i]-ps[j];
i++;
j--;
}
cout<<"after reverse"<<endl;
cout<<ps<<endl;
return 0;
}
