摘要: #include <iostream>using namespace std;class A{public:A(double _data = 0.0) :data(_data){}A& operator =(const A& rhs){data = rhs.data;return *this;}friend A operator +(const A& lhs, const A& rhs);friend A operator -(const A& lhs, const A& rhs);friend A operator *(const 阅读全文
posted @ 2012-05-15 19:12 byfei 阅读(166) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;class A{public: A(double _data = 0.0) : data(_data) { } A& operator =(const A& rhs) { da... 阅读全文
posted @ 2012-05-15 19:12 byfei 阅读(34) 评论(0) 推荐(0) 编辑
摘要: void str(char * a){char *toks = " ";char * tok = strtok(a, toks);while (tok){if (tok == a)strcpy(a, tok);elsestrcat(a, tok);tok = strtok(NULL, toks);}}int main(){string b = "this is a dog";str(const_cast<char*>(b.c_str()));cout<<b;return 0;}#include <iostream> # 阅读全文
posted @ 2012-05-15 15:29 byfei 阅读(465) 评论(0) 推荐(0) 编辑