上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 34 下一页

2013年11月20日

基于邻接矩阵的广度优先搜索遍历

摘要: 1 # include <stdio.h> 2 # include <string.h> 3 int map[100][100],vist[100]; 4 int q[100]; //优先队列存储临时值。 5 int n,m,t,flag; 6 void BFS(int t) 7 { 8 int f 阅读全文

posted @ 2013-11-20 08:27 随风浪子的博客 阅读(192) 评论(0) 推荐(0) 编辑

2013年10月25日

对象数组的应用

摘要: #include io代表输入输出,manip是manipulator(操纵器)的缩写(在c++上只能通过输入缩写才有效。)iomanip的作用:主要是对cin,cout之类的一些操纵运算子,比如setfill,setw,setbase,setprecision等等。它是I/O流控制头文件,就像C里面的格式化输出一样.▲ setprecision用法使用setprecision(n)可控制输出流显示浮点数的数字个数。C++默认的流输出数值有效位是6。如果setprecision(n)与setiosflags(ios::fixed)合用,可以控制小数点右边的数字个数。setiosflags(io 阅读全文

posted @ 2013-10-25 17:19 随风浪子的博客 阅读(310) 评论(0) 推荐(0) 编辑

对象的复制(复制构造函数)

摘要: # include # include using namespace std;class rect{private: double length; double width;public: rect(double length=0,double width=0); //rect(const rect&); //对象复制构造函可有可无 void output() { if(length>length>>width; }};rect::rect(double h,double w){ length=h; width=w;}//r... 阅读全文

posted @ 2013-10-25 16:53 随风浪子的博客 阅读(102) 评论(0) 推荐(0) 编辑

构造函数和析构函数程序举例

摘要: # include # include using namespace std;class A{public:A() { cout<<"constructing an object of A"<<endl; } ~A() { cout<<"Destructing an object of A"<<endl; }};void temporary(){ A b;}int main(){ cout<<"----begin main---"<<endl; A a; tem 阅读全文

posted @ 2013-10-25 16:20 随风浪子的博客 阅读(167) 评论(0) 推荐(0) 编辑

2013年10月10日

字符串连接的几种实现

摘要: 利用系统函数: BF(Brute-Force,布鲁斯-福斯)算法 阅读全文

posted @ 2013-10-10 10:59 随风浪子的博客 阅读(299) 评论(0) 推荐(0) 编辑

上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 34 下一页

导航