摘要: #include <iostream>#include <string>using namespace std;void main(){ string card="card(s)"; double num=2; double res=0; double end; cin>>end; int what=0; while (res<=end) { res+=1/(num++); what++; } if (end>0) cout<<what<<" "<<card<< 阅读全文
posted @ 2012-02-09 15:10 Dsp Tian 阅读(395) 评论(0) 推荐(0) 编辑
摘要: #pragma warning (disable:4786)#include <iostream>#include <map>#include <algorithm>#include <string>#include <vector>using namespace std;typedef struct { string first; int second;}res;bool less_first(res tmp1,res tmp2){ return tmp1.first<tmp2.first;}bool my_equal(res 阅读全文
posted @ 2012-02-09 13:12 Dsp Tian 阅读(476) 评论(0) 推荐(0) 编辑
摘要: #include <string.h>#include <vector>#include <algorithm>#include <string>#include <iostream>using namespace std;void main(){ string m("----------asdfas--------------dfgdf---------"); string::iterator it; vector<char> csr; vector<char>::iterator cit 阅读全文
posted @ 2012-02-09 01:03 Dsp Tian 阅读(687) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <vector>#include <string>#include <algorithm>using namespace std;void main(){ string num; string strset1="."; string strset2="0"; int n; int wei; int sum_wei; cin>>num>>n; int first=num.find_first_of(strset1); if (fi 阅读全文
posted @ 2012-02-08 20:56 Dsp Tian 阅读(442) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std; void main(){ int a,b; cin>>a>>b; cout<<a+b<<endl;} 阅读全文
posted @ 2012-02-08 15:25 Dsp Tian 阅读(389) 评论(0) 推荐(0) 编辑
摘要: #include <string>#include <iostream>#include <algorithm>#include <vector>#include <fstream>using namespace std;int main(){ ifstream in("data.txt"); string strtmp; vector<string> vect; while (getline(in,strtmp,'\n')) vect.push_back(strtmp); copy(v 阅读全文
posted @ 2012-02-08 13:18 Dsp Tian 阅读(624) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <vector>#include <algorithm>using namespace std;int testscore[] = {67, 56, 24, 78, 99, 87, 56}; void main(){ vector<int> score(testscore,testscore+sizeof(testscore)/sizeof(int)); vector<int>::iterator it; copy(score.begin(),score.end(),ostrea 阅读全文
posted @ 2012-02-08 00:00 Dsp Tian 阅读(647) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <vector>#include <algorithm>#include <numeric>#include <string>using namespace std;int testscore[] = {67, 56, 24, 78, 99, 87, 56}; bool pass(int n){ if (n>=60) return true; else return false;}void main(){ vector<int> score(testscore, 阅读全文
posted @ 2012-02-07 21:27 Dsp Tian 阅读(791) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <vector>#include <string>#include <boost/shared_ptr.hpp>class A{public: A(std::string s){a=s;} std::string a; void print(){std::cout<<a<<'\n';} };void main(){ boost::shared_ptr<A> p1(new A("2345")); boost::shared 阅读全文
posted @ 2012-02-07 17:52 Dsp Tian 阅读(559) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string>#include <boost/lexical_cast.hpp>using namespace std;using namespace boost;int main(){ string i; try { i=lexical_cast<string>(123.134); } catch(bad_lexical_cast&e) { cout<<e.what()<<endl; return 1; } cout<<i<<end 阅读全文
posted @ 2012-02-06 22:01 Dsp Tian 阅读(739) 评论(0) 推荐(0) 编辑