- 博客(7)
- 收藏
- 关注
原创 模板函数
#include<iostream> #include<string> using namespace std; template<typename T> void Swap(T &a, T &b); int main() { string i = "abc", j = "cba"; cout << i <&
2019-02-22 10:09:08 102
原创 C++ primer plus 学习,函数--默认参数
#include<iostream> #include<string> using namespace std; char* left(const char* str, int n = 4);//设置默认参数n=4 int main() { char str[20]; cin.get(str,20); char *ps = left(str, 8);//n=8,主动赋...
2019-02-22 10:08:16 145
原创 函数参数传引用与传指针
#include<iostream> #include<string> using namespace std; void swapr(int &a, int &b); void swapp(int* a, int* b); int main() { int left=123, right=321; cout << "no swap:\t" ...
2019-02-22 10:06:58 280
原创 学习C++ Primer Plus 深入探讨函数指针示例记录
#include&amp;lt;iostream&amp;gt; #include&amp;lt;string&amp;gt; using namespace std; const double * f1(const double ar[], int n);//f1返回ar,*ar=1112.3 const double * f2(const double [], int);//f2返回ar+1,*(ar+1)=1542.6 c...
2019-02-15 11:29:26 217
原创 C++ Void函数指针运用(无参数无返回值)
#include<iostream> #include<string> using namespace std; void happy(void); void unhappy(void); void mood(void(*pf)(void)); int main() { cout << "If you think someone make you happy:...
2019-02-13 15:29:31 3500
转载 C++函数指针示例
#include<iostream> #include<string> //#include<fstream> //#include<math.h> using namespace std; double betsy(int); double pam(int); void estimate(int lines, double(*pf)(int)); ...
2019-02-13 14:53:02 251
转载 记录C++ primer plus 学习函数递归示例代码
#include<iostream> #include<string> //#include<fstream> //#include<math.h> using namespace std; const int Len = 66; const int Divs = 6; void subdivide(char ar[], int low, int h...
2019-02-13 09:40:27 179
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人