C/C++语言经典问题源码解析
文章平均质量分 77
striving_boy
本科生!!工作单位:网易杭州网络有限公司
展开
-
八皇后问题源码
<br />#include <stdio.h><br />static char Quence[8][8];<br />static int Columms[8]; <br />static int main_diagonal[15];<br />static int second_diagonal[15];<br />static int iQuence_num = 0;<br /><br />void solve_quence(int i, int num); //i表示行<br />void Pri原创 2011-05-18 22:43:00 · 556 阅读 · 0 评论 -
C++写的集合的交叉并
<br />#include <iostream><br />#include <stdlib.h><br />#include <memory.h><br />using namespace std;<br />class Set<br />{<br /> friend void InsertSort(int *array1, int len);<br /> friend void MergePlus(int *array1, const int *arrA,const int *arrB,<br />原创 2011-05-24 23:15:00 · 1087 阅读 · 0 评论 -
C++写的集合的交叉并
<br />#include <iostream><br />#include <stdlib.h><br />#include <memory.h><br />using namespace std;<br />class Set<br />{<br /> friend void InsertSort(int *array1, int len);<br /> friend void MergePlus(int *array1, const int *arrA,const int *arrB,<br />原创 2011-05-23 22:54:00 · 845 阅读 · 0 评论 -
年份的加减运算符重载C++Code
<br />#include <iostream><br />#include <string><br />#include <math.h><br />using namespace std;<br />class CDate<br />{<br /> friend ostream &operator<<(ostream &os, const CDate &other);<br />public:<br /> CDate(int y = 0, int m = 0, int d = 0)<br /> {<b原创 2011-05-24 23:17:00 · 825 阅读 · 0 评论 -
C++写的集合的交叉并
<br />#include <iostream><br />#include <stdlib.h><br />#include <memory.h><br />using namespace std;<br />class Set<br />{<br /> friend void InsertSort(int *array1, int len);<br /> friend void MergePlus(int *array1, const int *arrA,const int *arrB,<br />原创 2011-05-24 23:15:00 · 748 阅读 · 0 评论 -
日期加减运算符重载C++修改
<br />#include <iostream><br />#include <string><br />#include <math.h><br />using namespace std;<br />class CDate<br />{<br /> friend ostream &operator<<(ostream &os, const CDate &other);<br />public:<br /> CDate(int y = 0, int m = 0, int d = 0)<br /> {<b原创 2011-05-25 13:10:00 · 4902 阅读 · 2 评论 -
C 语言里面的多态
<br />#if 1<br />//一C语言中使用宏来实现多态性<br />#include <stdio.h><br />#define MAX(a, b) (((a) > (b)) ? (a) : (b))<br />int main()<br />{<br /> int res1;<br /> double res2;<br /> res1 = MAX(5, 9);<br /> res2 = MAX(5.6, 4.99);<br /> printf("The max of 5 and 9 is :原创 2011-05-25 22:53:00 · 638 阅读 · 0 评论 -
如何将一个值(如,一个数字)转换为 std::string
[15.12] 如何将一个值(如,一个数字)转换为 std::string? 有两种方法:可以使用工具或库。通常,你应该使用库。 库允许你使用如下的语法(转换一个double的示例,但你可以替换美妙的多的任何使用#include #include #include std::string convertToString(double x){ std::原创 2012-02-14 12:32:34 · 5438 阅读 · 0 评论