<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IT公司面试手册 &#187; C++</title>
	<atom:link href="http://www.mianwww.com/html/category/it-interview/cpp/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mianwww.com</link>
	<description></description>
	<lastBuildDate>Wed, 08 Feb 2012 11:48:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>c++如何连接mysql</title>
		<link>http://www.mianwww.com/html/2012/01/12746.html</link>
		<comments>http://www.mianwww.com/html/2012/01/12746.html#comments</comments>
		<pubDate>Tue, 17 Jan 2012 14:33:00 +0000</pubDate>
		<dc:creator>jim.jin</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://www.mianwww.com/html/2012/01/12746.html</guid>
		<description><![CDATA[编译环境：myeclipse+cdt+MinGW，注意事项： 1.安装MySQL时，要选上安装开发组件 2.把MySQL安装目录的MySQL Server 5.0\lib\debug下面的两个文件libmysql.lib和libmysql.dll，复制到C++工程项目文件夹里 3.把MySQL安装目录下的include文件夹，复制到C++工程项目文件夹里。 4.如果使用vc6.0，可以在程序中这样使用库文件 #pragma comment(lib,&#8221;libmysql.lib&#8221;) 但现在用的是cdt+MinGW，必须在eclipse中进行设置 项目属性->C/C++ Build->Settings->Tool Settings->GCC C++ Compiler->Directories->include paths里添加头文件的位置，如： d:\workspace\cproject\include 项目属性->C/C++ Build->Settings->Tool Settings->MinGW C++ Linker->Miscellaneous->other objects里添加 libmysql.lib 文件的位置，如： d:\workspace\cproject\libmysql.lib 载入C++项目 #include #include #include &#8220;include\mysql.h&#8221; using namespace std; int main() { char *user_name = &#8220;root&#8221;; char *user_pw = &#8220;root&#8221;; char *db_name = &#8220;db_money&#8221;; char *db_host = &#8220;localhost&#8221;; int db_port [...]]]></description>
		<wfw:commentRss>http://www.mianwww.com/html/2012/01/12746.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++笔试题</title>
		<link>http://www.mianwww.com/html/2012/01/12656.html</link>
		<comments>http://www.mianwww.com/html/2012/01/12656.html#comments</comments>
		<pubDate>Sat, 07 Jan 2012 15:44:35 +0000</pubDate>
		<dc:creator>jim.jin</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://www.mianwww.com/html/2012/01/12656.html</guid>
		<description><![CDATA[一、选择题 1．下面各项不属于派生新类范畴的是（C ） A．吸收基类的成员 B．改造基类的成员 C．删除基类的成员 D．添加新成员 2．在派生新类的过程中，（ D ） A．基类的所有成员都被继承 B．只有基类的构造函数不被继承 C．只有基类的析构函数不被继承 D．基类的构造函数和析构函数都不被继承 3．下面不属于类的继承方式的是（ C ） A．public B．private C．operator D．protected 4．作用域分辨符是指（ B ） A．？： B． ：： C．-> D．&#038;&#038; 5．专用多态是指（ A ） A．重载多态和强制多态 B．强制多态和包含多态 C．包含多态和参数多态 D．参数多态和重载多态 6．通用多态是指（ C ） A．重载多态和强制多态 B．强制多态和包含多态 C．包含多态和参数多态 D．参数多态和重载多态 7．下面各项中属于不可重载的一组运算符是（ C ） A．+、—、*、/ B．[ ]、（） C． ：：、．、？：、sizeof、．* D．++、—— 8．关于类的构造函数，下面说法不正确的是（ C ） [...]]]></description>
		<wfw:commentRss>http://www.mianwww.com/html/2012/01/12656.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++指针面试题</title>
		<link>http://www.mianwww.com/html/2011/11/12277.html</link>
		<comments>http://www.mianwww.com/html/2011/11/12277.html#comments</comments>
		<pubDate>Sat, 26 Nov 2011 16:10:54 +0000</pubDate>
		<dc:creator>jim.jin</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://www.mianwww.com/?p=12277</guid>
		<description><![CDATA[#include&#60;stdio.h&#62; main(){ int c[3][3]={1,2,3,4,5,6,7,8,9}; for(int i=0;i&#60;3;i++) for(int j=0;j&#60;3;j++) printf(&#8220;%ld\n&#8221;,&#38;c[j]); printf(&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-\n&#8221;); printf(&#8220;%ld\n&#8221;,(c+1)); printf(&#8220;%ld\n&#8221;,(*c+1)); printf(&#8220;%ld\n&#8221;,&#38;c[0][0]); printf(&#8220;%ld\n&#8221;,**c); printf(&#8220;%ld\n&#8221;,*c[0]); if(int(c)==int(*c)) printf(&#8220;equl&#8221;); } 为什么c，*c的值相等，（c+1），（*c+1）的值不等 c，*c，**c，代表什么意思？ c是第一个元素的地址，*c是第一行元素的首地址，其实第一行元素的地址就是第一个元素的地址，这容易理解。**c是提领第一个元素。 为什么c，*c的值相等？ int c因为直接用c表示数组c[0][0] printf(&#8220;%ld\n&#8221;,*c[0]);语句已将指针移到数组头。 int(*c)表示c0的值为1，所以相等。 数组c的存放空间示意如下：（机器中是行优先存放的） c[0][0] c[0][1] c[0][2] c[1][0] c[1][1] c[1][2] c[2][0] c[2][1] c[2][2] c是一个二维数组名，实际上它是一个指针常量，不能进行自加、自减运算，即：c++、c&#8211;、++c、&#8211;c 都是不允许的； c：  数组名；是一个二维指针，它的值就是数组的首地址，也即第一行元素的首地址（等于 *c），也 等于第一行第一个元素的地址（ &#38; c[0][0]）；可以说成是二维数组的行指针。 *c： 第一行元素的首地址；是一个一维指针，可以说成是二维数组的列指针。 **c：二维数组中的第一个元素的值；即：c[0][0] 所以： c 和 *c的值是相等的，但他们两者不能相互赋值，（类型不同）； （c + 1） ：c是行指针，（c [...]]]></description>
		<wfw:commentRss>http://www.mianwww.com/html/2011/11/12277.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>输入一个n ，然后在屏幕上打印出NxN 的矩阵！</title>
		<link>http://www.mianwww.com/html/2011/11/12271.html</link>
		<comments>http://www.mianwww.com/html/2011/11/12271.html#comments</comments>
		<pubDate>Sat, 26 Nov 2011 16:02:10 +0000</pubDate>
		<dc:creator>jim.jin</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://www.mianwww.com/?p=12271</guid>
		<description><![CDATA[例如，输入一个3，则 打印出 1 2 3 8 9 4 7 6 5 输入一个4，则 打印出 1    2  3  4 12 13 14 5 11 16 15 6 10  9  8  7 答案如下： #include&#60;stdio.h&#62; #include&#60;conio.h&#62; #define N 10 void printCube(int a[][N],int n); void main() { int a[N][N],n; printf(&#8220;input n:\n&#8221;); scanf(&#8220;%d&#8221;,&#38;n); printCube(&#38;a[0],n); getch(); } void printCube(int a[][N],int n) { [...]]]></description>
		<wfw:commentRss>http://www.mianwww.com/html/2011/11/12271.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C/C++基础面试题</title>
		<link>http://www.mianwww.com/html/2011/11/11949.html</link>
		<comments>http://www.mianwww.com/html/2011/11/11949.html#comments</comments>
		<pubDate>Tue, 15 Nov 2011 14:30:44 +0000</pubDate>
		<dc:creator>jim.jin</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://www.mianwww.com/?p=11949</guid>
		<description><![CDATA[1、 关键字理解：const、static、volatile、sizeof、malloc/free、new/delete、extern、#ifndef/#endif、virtual、define、typedef、namespace等，重点是sizeof、virtual、const。 2、 关于sizeof结果，请注意内存对齐问题。 3、 关于virtual，请理解虚函数、纯虚函数、虚函数表、虚继承，选择性了解虚继承时父子类虚函数表的内存结构，并了解此时sizeof结果。 4、 指针，肯定的重难点啦，选择性了解智能指针、句柄。 5、 面向对象，注意父子类构造、析构函数的调用顺序，其中涉及虚继承的情况。 6、 继承，C++支持多继承，理解虚继承产生的必要，区分使用继承和组合的情况。 7、 多态，区分覆盖（编译时绑定，同名函数，与多态无关）与重载（运行时绑定，虚函数，实现多态）。 8、 字符串处理，这个太多了，常与算法结合，举几个栗子，按单词翻转、判断A是否包含B、一个字符串中字母的所有排列或组合等。 9、 区分char* str1=”hello”;与char str2[]=”hello”的区别（长度和内存中位置）。 10、文件处理，打开、关闭、读、写总要会吧。 11、设计模式。 12、较为熟练的使用STL容器，如vector、queue、deque、stack、set等。]]></description>
		<wfw:commentRss>http://www.mianwww.com/html/2011/11/11949.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Com组件方面面试题</title>
		<link>http://www.mianwww.com/html/2011/11/11921.html</link>
		<comments>http://www.mianwww.com/html/2011/11/11921.html#comments</comments>
		<pubDate>Mon, 14 Nov 2011 11:07:24 +0000</pubDate>
		<dc:creator>jim.jin</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://www.mianwww.com/?p=11921</guid>
		<description><![CDATA[1.什么是COM?你怎么理解COM? 答：Components Object Model(COM)是软件组件互相通信的一种方式。它是一种二进制和网络标准，允许任意两个组件互相通信，而不管它们是在什么计算机上运行(只要计算机是相连的)，不管各计算机运行的是什么操作系统(只要该系统支持COM),也不管该组件是用什么语言编写的。COM还提供了位置透明性：当你编写组件时，其他组件是进程内DLL、本地EXE，还是位于其他计算机上的组件，对用户而言都无所谓。 首先，COM对象被很好地封装起来。你无法访问对象的内部实现细节，你无法知道对象使用了什么数据结构，但是我们可以通过接口来访问COM对象里面的方法。 概括地说，COM具有如下一些优越性：(1)编程技术难度和工作量降低，开发周期变短，开发成本降低。(2)实现分层次的编程，从而促进了软件的专业化生产。(3)软件的复用率提高，使软件的使用效率得到提高并延长了使用寿命。 2.COM是接口么？ 答：(1)COM不是接口，也不是对象，它是一种标准。(2)符合COM标准的对象就是COM对象。其实COM对象无非是实现了很多接口的对象而已。(3)COM对象必须实现IUnKnown接口,这个接口是管理COM对象生命周期的。当COM对象不使用的时候，这个接口定义的方法负责释放内存。(4)QueryInterface(QI)，即所谓查询接口。由于COM对象有很多个接口，不同的接口管理着COM的不同类型的方法。因此从一个接口可以使用的方法转到另一个接口可以使用的方法的过程称为QI,这个过程是由Idispatch接口管理的。(5)GUIDs每个组件都有一个独一无二的标识，这个标识符就是COM组件的身份，它是一个128位的数字，由系统自由分配。(6)一个COM对象可以有多个接口，一个接口也完全可以被多个COM 对象实现。(7)接口分为两种：内置接口和外置接口。前一种定义的是COM对象的方法和属性，用implements实现，COM对象必须实现所有的接口内容；后一种定义的是COM对象的事件，用withEvents实现，这种接口在实现的时候不必实现所有的内容。(8)COM组件必须被注册后才能使用，它得到注册表那里去登记“户口”。 3.COM有什么缺陷？ 答：COM组件很不错，可是它也有致命的缺陷，这个缺陷就来自它本身。COM是可以被重用的，COM对象的实现过程也可以被修改升级(定义是不能修改的)。如果两个程序都使用一个COM对象，而这个COM组件升级的话，很可能会出现某个程序无非使用新组件的情况，这被称为“DLL HELL”（DLL灾难）。有时候我们安装了新软件后很多别的软件就无法使用了，很大程度上就是因为这个DLL HELL。]]></description>
		<wfw:commentRss>http://www.mianwww.com/html/2011/11/11921.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C++问题</title>
		<link>http://www.mianwww.com/html/2011/11/11740.html</link>
		<comments>http://www.mianwww.com/html/2011/11/11740.html#comments</comments>
		<pubDate>Thu, 10 Nov 2011 11:29:35 +0000</pubDate>
		<dc:creator>jim.jin</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://www.mianwww.com/?p=11740</guid>
		<description><![CDATA[1. c++中指针的优缺点有哪些 答案：优点： (1)提高程序的编译效率和执行速度。 (2)通过指针可使用主调函数和被调函数之间共享变量或数据结构，便于实现双向数据通讯。 (3)可以实现动态的存储分配。 (4)便于表示各种数据结构，编写高质量的程序。 缺点： (1)使用未正确初始化的指针导致程序崩溃 (2)引用已释放的指针 (3)通过指针访问不该访问的内存 2. 宏和函数的区别 答案：(1)宏做的是简单的字符串替换(注意是字符串的替换，不是其他类型参数的替换)，而函数的参数的传递，参数是有数据类型的，可以是各种各样的类型。 (2)宏的参数替换是不经计算而直接处理的，而函数调用是将实参的值传递给形参，是计算得来的。 (3)宏在编译之前进行，即先用宏体替换宏名，然后再编译的，而函数是编译之后，在执行时，才调用的。因此，宏占用的是编译的时间，而函数占用的是执行时的时间。 (4)宏的参数是不占内存空间的，因为只是做字符串的替换，而函数调用时的参数传递则是具体变量之间的信息传递，形参作为函数的局部变量，是占用内存的。 (5)函数的调用是需要付出一定的时空开销的，因为系统在调用函数时，要保留现场，然后转入被调用函数去执行，调用完，再返回主调函数，此时再恢复现场，这些操作，显然在宏中是没有的。 3. 宏定义是什么时期处理的（预处理？编译期？） 答案：预处理 4. 不同情况下类对象的大小（有数据成员，无数据成员，有虚函数等） 答案：(1)无任何数据成员和虚函数的类大小为1 (2)每个虚函数大小为4 (3)成员变量大小要考虑内存对齐，通常是4字节对齐 5. STL中vector使用的时候要注意什么 答案：(1) 如果元素是对象的指针，当该vector超出其作用域或调用erase删除元素时，那么元素本身在该vector中会被删除，但对象本身并没有得到销毁。在这种情况下，销毁的工作要由程序员自己来做。 (2) 用erase删除vector容器中的元素对象时，元素对象的析构函数会被多次调用。 6. 字符转整型数的函数是什么？ 是怎样实现的？ 答案： strtol、strtoul。 #define TOLOWER(x) ((x) &#124; 0&#215;20) #define isxdigit(c) ((&#8217;0&#8242;]]></description>
		<wfw:commentRss>http://www.mianwww.com/html/2011/11/11740.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++题目</title>
		<link>http://www.mianwww.com/html/2011/11/11715.html</link>
		<comments>http://www.mianwww.com/html/2011/11/11715.html#comments</comments>
		<pubDate>Wed, 09 Nov 2011 11:30:42 +0000</pubDate>
		<dc:creator>jim.jin</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://www.mianwww.com/?p=11715</guid>
		<description><![CDATA[1。给定下面的代码: class Graph{ public: Graph() { s_gCount++; } virtual ~Graph() { s_gCount–;} virtual int drawOut() = 0; &#160; static int getTotalCount() { return s_gCount; } protected: int m_x; int m_y; static int s_gCount; }; &#160; 回答下列问题：(各5分) &#160; 1）这个类能否生成实例，为什么？ 2）上述代码中有什么错误？ 3）如果有一个Rectangle类公共继承该类，那么s_gCount对Rectangle的成员属性是什么？ 4）对Graph及其子类的计数是否有效，如果无效应该采取什么措施？ 5）请画出该类的内存布局结构示意图 &#160; ———————————————————– 2。给定下面的代码: class A { int a; }; class AA : public [...]]]></description>
		<wfw:commentRss>http://www.mianwww.com/html/2011/11/11715.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>明基（BENQ）2012校园招聘笔试题之C++方向</title>
		<link>http://www.mianwww.com/html/2011/11/11625.html</link>
		<comments>http://www.mianwww.com/html/2011/11/11625.html#comments</comments>
		<pubDate>Sun, 06 Nov 2011 09:04:25 +0000</pubDate>
		<dc:creator>jim.jin</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://www.mianwww.com/?p=11625</guid>
		<description><![CDATA[1. What’s overload function in C++? &#160; 2. A. What’s inline function in C++? B. When would you use inline function? C. Please write sample code. &#160; 3. Which of the following are legal? For those usages that are illegal, explain why. const int buf; int cnt = 0; const int sz = cnt; cnt++; [...]]]></description>
		<wfw:commentRss>http://www.mianwww.com/html/2011/11/11625.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用递归实现链表逆序</title>
		<link>http://www.mianwww.com/html/2011/10/11459.html</link>
		<comments>http://www.mianwww.com/html/2011/10/11459.html#comments</comments>
		<pubDate>Thu, 27 Oct 2011 14:48:54 +0000</pubDate>
		<dc:creator>jim.jin</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://www.mianwww.com/?p=11459</guid>
		<description><![CDATA[C语言风格的代码： #include &#60;stdio.h&#62; #include &#60;stdlib.h&#62; #include &#60;time.h&#62; const int M=10; typedef int Type; typedef struct Node{ Type data; struct Node* next; }Node; void add_elem(Node **head,Type data){ Node* tmp = (Node*)malloc(sizeof(Node)); tmp-&#62;data = data; tmp-&#62;next = (*head); *head = tmp; } void print_list(Node *head){ while(head){ printf(&#8220;%d &#8220;, head-&#62;data); head = head-&#62;next; } printf(&#8220;\n&#8221;); } void reverse_list(Node [...]]]></description>
		<wfw:commentRss>http://www.mianwww.com/html/2011/10/11459.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

