第十五周程序-阅读程序-5
来源:互联网 发布:阿里云按量付费1g 编辑:程序博客网 时间:2024/06/08 08:18
/*copyright(c)2016.烟台大学计算机学院 * All rights reserved, * 文件名称:text.Cpp * 作者:刘涛 * 完成日期:2016年6月5日 * 版本号:vc++6.0 * 问题描述:阅读下面程序,并写出运行结果 */#include <iterator>#include <algorithm>#include <functional>#include <iostream>#include <vector>using namespace std;class Angle{ int degrees;public: Angle(int deg) : degrees(deg) {} int mul(int times) { return degrees *= times; }};int main(){ int x[] = {1, 2, 4, 5, 8}; vector<Angle> va; for(int i =10; i <= 50; i += 10) va.push_back(Angle(i)); transform(va.begin(), va.end(), x, ostream_iterator<int>(cout , " "), mem_fun_ref(&Angle::mul));//迭代器去调用成员函数. cout << endl; return 0;}
运行结果:
0 0
- 第十五周--阅读程序5
- 第十五周程序-阅读程序-5
- 第十五周阅读程序
- 第十五周阅读程序
- 第十五周--阅读程序
- 第十五周程序-阅读程序
- 第十五周阅读程序(5)
- 第十五周 阅读程序(5)
- 第十五周项目—阅读程序(5)
- 第十五周项目 阅读程序 (5)
- 第十五周阅读程序(5)
- 第十五周项目—阅读程序(5)
- 第十五周阅读程序——5
- 第十五周(5)-阅读程序
- 第十五周 程序阅读二
- 第十五周阅读程序1
- 第十五周阅读程序2
- 第十五周阅读程序3
- LightOJ 1294 Positive Negative Sign 求和的升级版 暑期练习T
- 栈帧
- 在QT的界面工程中添加一个简单的线程socket通信
- Mysql外检约束的参照操作
- 算分与数据结构 - 冒泡思想
- 第十五周程序-阅读程序-5
- 【leetcode】171. Excel Sheet Column Number
- Android Scroller大揭秘
- 第十二周项目1-实现复数类中的运算符重载(2)
- 完美cvCreateVideoWriter写出AVI文件为空的问题
- 第十二周上机实践项目4:String类的构造
- 关于ScheduledExecutorService执行一段时间之后就不执行的问
- 计算机视觉近两年部分综述文章-4
- 括号配对问题