2006年10月北京中软笔试题
出自求职百科
点击排行
- Index - (295638)
- 华为 - (98218)
- 宝洁 - (90492)
- 普华永道 - (74500)
- IBM - (70478)
- 毕马威 - (60811)
- 中国银行 - (60193)
- SAP - (54398)
- 富士康 - (52854)
- 招商银行 - (47785)
最近更新
北京中软笔试题
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;
}
