2012.9.20 IGT笔试简记
来源:互联网 发布:ps 子程序 Linux 编辑:程序博客网 时间:2024/05/14 22:31
1.输出结果:
#include <iostream>using namespace std;class Person{ public: char Name[10]; int Age;};int main(){ Person a; cout<<sizeof(int)<<endl; cout<<sizeof(double)<<endl; cout<<sizeof(a)<<endl; return 0; }答案:
4
8
16
2.输出结果:
#include <iostream>#define BAND(x) (((x)>=5&&(x)<=10)?x:0) using namespace std;int main(){ int a=4; cout<<"BAND(++a)="<<BAND(++a)<<endl; return 0; }答案:
BAND(++a)=7
解析:将(++a)带入宏定义,有(((++a)>=5 && (++a)<=10)?(++a):0),可以看出对a进行了三次++操作。
3.singleton mode and its implementation
4.static in C++
5.pure virtual function
6. Reverse string: as "Hello world" into "world Hello"
#include <iostream>#include <string>#include <vector> using namespace std;int main(){ vector<string> vstr; string str; cout<<"Please input a string:"<<endl; while(cin>>str) vstr.push_back(str); vector<string>::reverse_iterator riter=vstr.rbegin(); for(riter;riter!=vstr.rend();++riter) cout<<*riter<<" "; cout<<endl; return 0; }输出结果:
解析:
用到了vector容器中的反向迭代器reverse_iterator(Iterator that addresses elements in reverse order),需要与此匹配的就是c.rbegin()与c.rend()了,分别返回容器c中的最后下一个的元素和最开始的元素。
- 2012.9.20 IGT笔试简记
- IGT笔试
- IGT 烦躁的笔试题
- 2013/10/11 IGT笔试
- igt
- IGT 2013校园招聘 笔试题
- IGT 2014年校园招聘笔试题
- IGT视频算法笔试题回忆版
- 2013 IGT笔试题 RGB序列有序化
- 一道IGT的关于RGB的笔试题
- IGT 2014校园招聘笔试题 武汉站
- 【2013 IGT 笔试题】剪不断理还乱的动态调用关系(继承+多态)
- IGT面试
- 简记
- 简记
- 简记
- 简记
- 简记
- BSS段、数据段、代码段、堆、栈
- 解决和处理SQL server2005死锁
- 编程思考杂记
- 进程上下文 中断
- MySQL多Text字段报8126错误(解决过程)
- 2012.9.20 IGT笔试简记
- Myeclipse配置tomcat出现的问题
- Handler
- Shell脚本学习——[小试牛刀]
- OMAP3 Linux中的中断
- 使用 UNICODE 和 ANSI 的混合编程
- poj 3233 矩阵乘法经典题
- oracle删除数据文件
- VCPROJ文件详解