上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要: >> c=[1,2,3,4,5]; >> toeplitz(c) ans = 1 2 3 4 5 2 1 2 3 4 3 2 1 2 3 4 3 2 1 2 5 4 3 2 1 ... 阅读全文
posted @ 2016-11-30 17:03 PirateLHX 阅读(498) 评论(0) 推荐(0)
摘要: #include #include #include #include using namespace std; /*struct类的定义*/ struct transform { string t_f1; string t_f2; }; /*函数声明*/ bool same(const string f1,const string f2) ; transform dif(... 阅读全文
posted @ 2016-11-27 20:24 PirateLHX 阅读(833) 评论(0) 推荐(0)
摘要: #include #include using namespace std; int main() { string s; cin>>s; cout<<s.at(2)<<endl; } 阅读全文
posted @ 2016-11-26 16:29 PirateLHX 阅读(663) 评论(0) 推荐(0)
摘要: #include #include #include #include using namespace std; /* 第一种方法 int main() { string a; cin>>a; reverse(a.begin(),a.end()); cout>a; vector v; vector::iterator iter; for(... 阅读全文
posted @ 2016-11-26 16:24 PirateLHX 阅读(121) 评论(0) 推荐(0)
摘要: 之所以抛弃char*的字符串而选用C++标准程序库中的string类,是因为他和前者比较起来,不必担心内存是否足够、字符串长度等等,而且作为一个类出现,他集成的操作函数足以完成我们大多数情况下(甚至是100%)的需要。我们可以用 = 进行赋值操作,== 进行比较,+ 做串联(是不是很简单?)。我们尽 阅读全文
posted @ 2016-11-26 15:01 PirateLHX 阅读(123) 评论(0) 推荐(0)
摘要: 在c++中,vector是一个十分有用的容器,下面对这个容器做一下总结。 1 基本操作 (1)头文件#include<vector>. (2)创建vector对象,vector<int> vec; (3)尾部插入数字:vec.push_back(a); (4)使用下标访问元素,cout<<vec[0 阅读全文
posted @ 2016-11-26 14:43 PirateLHX 阅读(141) 评论(0) 推荐(0)
摘要: #include using namespace std; const double pi=3.141592653; int main() { int num; cin>>num; for(int i=0;i>x>>y; double sum; sum=pi*(x*x+y*y)/2; int year=1; for(year=1;year>0;year++) if(s... 阅读全文
posted @ 2016-11-24 21:35 PirateLHX 阅读(99) 评论(0) 推荐(0)
摘要: 今天是我生命中最对不起的人--爷爷的百日祭日,首先,先解释下为什么是最对不起呢,其实于我而言,我父亲和母亲结婚比较早,这让我其实很幸运,一出生时爷爷奶奶也刚还不到50岁,事实上直到最近几年我都没想过自己要开始承受失去亲人的痛苦,但正如你我所知,生老病死本就是人世间的不变定律,又有谁能避免得了呢?最近 阅读全文
posted @ 2016-11-23 21:05 PirateLHX 阅读(178) 评论(0) 推荐(0)
摘要: /* 最一般合一(mgu)算法实现 */ #include #include #include using namespace std; struct transform //一组置换 { string t_f1; string t_f2; }; //函数声明 bool same(const string f1,const string f2) ; transf... 阅读全文
posted @ 2016-11-22 08:43 PirateLHX 阅读(2665) 评论(0) 推荐(0)
摘要: #include #include #include using namespace std; int main() { stack s; stack b; string a; cin>>a; int flag=0; if(a[0]=='P'||a[0]=='Q'||a[0]=='R'||a[0]=='S'||a[0]=='T') couta[i]&&a[i]>'z')) ... 阅读全文
posted @ 2016-11-22 08:43 PirateLHX 阅读(151) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 下一页